Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET General > Imports Classes On Design or/in Code?


Reply
 
Thread Tools Display Modes
  #1  
Old 08-10-2005, 10:11 PM
hardrain's Avatar
hardrain hardrain is offline
Junior Contributor
 
Join Date: Dec 2003
Location: Manila, Philippines
Posts: 277
Default Imports Classes On Design or/in Code?


Item #1:
Project Reference > DLLClass1
Project Properties > Imports > Namespace.Namespace2
- In Code Behind:
* Dim NewClass1 As New Class1

Item #2:
Project Reference > DLLClass1
- In Code Behind:
* Dim NewClass1 As New Namespace.Namespace2.Class1

* What will be better? Item #1 or #2?, Does MS have an article for this? (I
need proof for this matter, about their performance, advantages and
disadvantages.)

Thanks in Advance!
__________________
It's been a while.
Reply With Quote
  #2  
Old 08-11-2005, 12:14 AM
sgt_pinky's Avatar
sgt_pinky sgt_pinky is offline
Contributor
 
Join Date: Feb 2004
Location: Melbourne, Australia
Posts: 633
Default

Both are identical. Namespaces and classes have their own signatures, so the IDE/compiler will tell you if there are two classes/methods with the same name.

For example, if you program Direct3D and DirectSound, both Namespaces have the object called 'Device'. If you Import both Namespaces, then the IDE will get really upset and put blue squiggly lines all over the shop when you try and declare a New Device.
Reply With Quote
  #3  
Old 08-11-2005, 12:35 AM
hardrain's Avatar
hardrain hardrain is offline
Junior Contributor
 
Join Date: Dec 2003
Location: Manila, Philippines
Posts: 277
Default

Thanks, I think in performance it will be the same.
But to avoid the ambigous name for classes declarations, it should be Item #2.
__________________
It's been a while.
Reply With Quote
  #4  
Old 08-11-2005, 12:37 AM
sgt_pinky's Avatar
sgt_pinky sgt_pinky is offline
Contributor
 
Join Date: Feb 2004
Location: Melbourne, Australia
Posts: 633
Default

To avoid Repetitive Strain Injury I use Item #1.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->