473,379 Members | 1,491 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Long Class Name

I have a Static class which has a very large name which belongs to the same
Namespace as the class that I am working in. I want to create an "alias" for
this "big class name" so that I can save keystrokes and make the program more
readable. I am not sure how to do this globally within the class that I am
working.

Is there some way to do this?

So instead of typing
MyGiganticInformativeClassName.DoSomething()
I want to use
MGIC.DoSomething();

Nov 19 '05 #1
4 1102
Unfortunately, I don't think you can. A work-around though. What about having
a static property in your class that just serves as a wrapper for this
gigantic class name
such as
class SClass
{
string SomeValue
{
get
{
return LognClassName.SomeValue;
}
set
{
LongClassName.SomeValue=value;
}

}
}
--
Aarthi R S

"Jim Heavey" wrote:
I have a Static class which has a very large name which belongs to the same
Namespace as the class that I am working in. I want to create an "alias" for
this "big class name" so that I can save keystrokes and make the program more
readable. I am not sure how to do this globally within the class that I am
working.

Is there some way to do this?

So instead of typing
MyGiganticInformativeClassName.DoSomething()
I want to use
MGIC.DoSomething();

Nov 19 '05 #2
Jim Heavey wrote:
I have a Static class which has a very large name which belongs to
the same Namespace as the class that I am working in. I want to
create an "alias" for this "big class name" so that I can save
keystrokes and make the program more readable. I am not sure how to
do this globally within the class that I am working.

Is there some way to do this?

So instead of typing
MyGiganticInformativeClassName.DoSomething()
I want to use
MGIC.DoSomething();


Yes.. this is entirely possible using "Using alias directives"

From the documentation:

A using-alias-directive introduces an identifier that serves as an
alias for a namespace or type within the immediately enclosing
compilation unit or namespace body.

using-alias-directive:
using identifier = namespace-or-type-name ;
Within member declarations in a compilation unit or namespace

For more information take a look at the MSDN documentation.

Dirc

--

Nov 19 '05 #3
Jim Heavey wrote:
I have a Static class which has a very large name which belongs to
the same Namespace as the class that I am working in. I want to
create an "alias" for this "big class name" so that I can save
keystrokes and make the program more readable. I am not sure how to
do this globally within the class that I am working.

Is there some way to do this?

So instead of typing
MyGiganticInformativeClassName.DoSomething()
I want to use
MGIC.DoSomething();


Of course the real question is why you decided to use a long name in
the first place and now want to use an alias?

Personally, I like long names if they are descriptive and helpful. If
you have used this name in the first case, I think it makes code more
readable and understandable if you use this name throughout your code.

Dirc

--

Nov 19 '05 #4
sorry..Two minutes after I posted this, I realized what Dirk has posted..you
can use something like
using AliasToMyClass = NameSpace1.MyClass;
--
Aarthi R.S
"Jim Heavey" wrote:
I have a Static class which has a very large name which belongs to the same
Namespace as the class that I am working in. I want to create an "alias" for
this "big class name" so that I can save keystrokes and make the program more
readable. I am not sure how to do this globally within the class that I am
working.

Is there some way to do this?

So instead of typing
MyGiganticInformativeClassName.DoSomething()
I want to use
MGIC.DoSomething();

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bryan Olson | last post by:
The current Python standard library provides two cryptographic hash functions: MD5 and SHA-1 . The authors of MD5 originally stated: It is conjectured that it is computationally infeasible to...
1
by: Yuriy | last post by:
Hi, Can anybody explain the following? Say I have the following source XML and XSLT (see below). No matter what this XSLT does. It is just a sample to show a problem. the idea is that XSLT...
4
by: Remi Hugnon | last post by:
Hi, I want to build an expandable treeview. I saw some code on VB but I know only C# I plan for my class that each nodes has its own id (using span for example). Into a single aspx page...
9
by: esakal | last post by:
Hello, I'm programming an application based on CAB infrastructure in the client side (c# .net 2005) Since my application must be sequencally, i wrote all the code in the UI thread. my...
6
by: seb | last post by:
Hi, I am using pygtk for the first times. I am wondering what would be the best "pattern" to interface pygtk with a thread. The thread is collecting informations (over the network for...
0
by: RYoung | last post by:
Hi all, Hope no one minds this long message, but I'm puzzled: --------------- The following is a shortened version of schema located at...
1
by: halekio | last post by:
Hi all, Please bear with me as I've only started programming in C# 2 weeks ago and this is my first contact with OOP. I ran into a situation where I needed to catch an event in an object that...
3
by: chifm | last post by:
Hi ALL, I dont know much about php, but have got a long form that i need to split into two pages, i want to have the inputs from the page 1 past to page 2 and all submitted via email at the end. I...
0
by: altavim | last post by:
Usually when you make regular expression to extract text you are starting from simple expression. When you got to know target text, you are extending your expression. Subsequently very hard to ready...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.