How to create aliases in c#

Posted by Gaddigesh on Stack Overflow See other posts from Stack Overflow or by Gaddigesh
Published on 2010-04-12T13:09:42Z Indexed on 2010/04/12 13:13 UTC
Read the original article Hit count: 342

Filed under:
|

How do i create aliases in c#

Take this scenario

class CommandMessages
{
   string IDS_SPEC1_COMPONENT1_MODULE1_STRING1;
}

say i create an object of this class

CommandMessages objCommandMessage = new CommandMessages();

To i need to write lengthy string

objCommandMessage.IDS_SPEC1_COMPONENT1_MODULE1_STRING1 

every time i access the variable, this is a pain as i am using this variable as a key for a dictionary.

Dict[objCommandMessage.IDS_SPEC1_COMPONENT1_MODULE1_STRING1]

therefore i should be able to do something like this

Dict[str1]

where str1 is alias for objCommandMessage.IDS_SPEC1_COMPONENT1_MODULE1_STRING1, How do i do it?

© Stack Overflow or respective owner

Related posts about c#

Related posts about aliases