Tutorials
Resources
Forum
Reviews
Communities
Interview
Jobs
Projects
Training
Your
Ad
Here
Silverlight Games
|
Mentor
|
Code Converter
|
Articles
|
Code Factory
|
Computer Jokes
|
Members
|
Peer Appraisal
|
IT Companies
|
Bookmarks
|
Polls
|
Revenue Sharing
|
Lobby
|
Gift Shop
|
Prizes & Awards
My Profile
Sign In
Register
AdSense Revenue
Active Members
Today
Asheej T K
(152)
Manindra Upadh...
(76)
Avinash Mohan
(44)
Last 7 Days
Alwyn
(932)
Asheej T K
(725)
Manindra Upadh...
(542)
more...
Resources
»
Tips
»
Visual Studio
»
Creating Alias name for namespace
Posted Date: 01 Jul 2009
Resource Type:
Tips
Category:
Visual Studio
Author:
Viji RAJKUMAR
Member Level:
Diamond
Rating:
Points
: 3
The namespaces in .NET can be very long and less obvious.
And to refer the class of the name space we need to include the entire path.
There is a way to simplify this by creating your
own alias for the namespace.
How to do?
You can use the
Imports
statement (VB.NET) or
using directive
(C#) with an assignment operation.
Syntax:
VB
Imports < AliasName > = < NameSpace >
C#
Using < AliasName > = < NameSpace >
Example - VB
Imports MyaliasName = Microsoft.VisualBasic
Example - C#
Using MyaliasName = Microsoft.VisualBasic;
That way, you can refer to specific class elements within the class referred to using the variable you created in the assignment operation.
'VB
Private Sub TestFunction()
MyaliasName.MsgBox("I am Alias")
End Sub
// C#
void TestFunction()
{
MyaliasName.MsgBox("I am Alias");
}
Responses
Author:
nimesh
25 Jul 2009
Member Level:
Bronze
Points
: 0
Hello,
It's really nice.
Discribe more.
Thanks
-Nimesh
Feedbacks
Popular Tags
What are tags ?
Search Tags
Sign In
to add tags.
Namespace Usage
.
Creating Alias name for namespace
.
Post Feedback
This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must
Sign In
to post a response.
Next Resource:
.NET Windows Forms - Hide the display in task bar
Previous Resource:
How to retrieve other rows except 1st row from a data table.
Return to Discussion Resource Index
Post New Resource
Category:
Visual Studio
Post resources and
earn money
!
More Resources
.NET Windows Forms - Hide the display in task bar
.NET Windows Forms -Using XP Themes
Comment/ Un-Comment your code
Adding Ajax Control toolkit to visual studio 2008
BUTTON CLICK CREATE DIV AND PASSWORD TEXTBOX CONTROL
Easiest way to Format XML Data
dotNet Slackers
About Us
Contact Us
Privacy Policy
Terms Of Use