Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
AnswerRe: Check this out guys! Pin
J4amieC3-Jun-09 23:48
J4amieC3-Jun-09 23:48 
GeneralRe: Check this out guys! Pin
Rajdeep.NET4-Jun-09 6:10
Rajdeep.NET4-Jun-09 6:10 
GeneralRe: Check this out guys! Pin
J4amieC5-Jun-09 0:08
J4amieC5-Jun-09 0:08 
QuestionRe: Check this out guys! Pin
Rajesh R Subramanian3-Jun-09 23:57
professionalRajesh R Subramanian3-Jun-09 23:57 
AnswerRe: Check this out guys! Pin
EliottA4-Jun-09 7:15
EliottA4-Jun-09 7:15 
GeneralRe: Check this out guys! Pin
Rajesh R Subramanian4-Jun-09 18:50
professionalRajesh R Subramanian4-Jun-09 18:50 
AnswerBTW Pin
Rajesh R Subramanian4-Jun-09 0:03
professionalRajesh R Subramanian4-Jun-09 0:03 
QuestionHow to figure out whether an enum is defined in an assembly. [modified] Pin
_AnsHUMAN_ 3-Jun-09 22:01
_AnsHUMAN_ 3-Jun-09 22:01 
public class SomeEnumAttribute: DescriptionAttribute
    {
        public override string Description
        {
            get
            {
                string resFile;
                
                Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
                foreach (Assembly assembly in assemblies)
                {
                    Type type = assembly.GetType("/*The type defined needs to go in here*/"); //For eg: nameofdll.MyEnum
                    if (type != null)
                    {
	         // the type passed in GetType() is defined in this assembly so get the resource file name for it
                        resFile = assembly.GetName().Name ;
                        
                        // we have the name of the assembly - break now
                        break; 
                    }
                }
           }
       }
}
//We use this class from another binary in which MyEnum is defined
 public enum MyEnum
    {
        [SomeEnumAttribute("abc")]
        abc = 0,
        [SomeEnumAttribute("def")]
        def,
        [SomeEnumAttribute("ghi")]
        ghi,
        [SomeEnumAttribute("ghi1")]
        ghi1
    }

What we ought to do is this: Get the fully qualified name of the enum(MyEnum) and replace it with "/*The type defined needs to go in here*/" in the snippet above.
Can someone help with this.
Note: This class is defined in another binary.
<italics>In another words the question is can we get the enum name(type name) in which the attribute is being used.

You need to google first, if you have "It's urgent please" mentioned in your question.
Wink | ;-) _AnShUmAn_

modified on Thursday, June 4, 2009 4:11 AM

AnswerRe: How to figure out whether an enum is defined in an assembly. Pin
0x3c03-Jun-09 22:04
0x3c03-Jun-09 22:04 
GeneralRe: How to figure out whether an enum is defined in an assembly. Pin
_AnsHUMAN_ 3-Jun-09 22:06
_AnsHUMAN_ 3-Jun-09 22:06 
GeneralRe: How to figure out whether an enum is defined in an assembly. Pin
0x3c03-Jun-09 22:15
0x3c03-Jun-09 22:15 
GeneralRe: How to figure out whether an enum is defined in an assembly. Pin
_AnsHUMAN_ 3-Jun-09 22:45
_AnsHUMAN_ 3-Jun-09 22:45 
GeneralRe: How to figure out whether an enum is defined in an assembly. Pin
0x3c03-Jun-09 22:57
0x3c03-Jun-09 22:57 
GeneralRe: How to figure out whether an enum is defined in an assembly. Pin
_AnsHUMAN_ 3-Jun-09 23:43
_AnsHUMAN_ 3-Jun-09 23:43 
GeneralRe: How to figure out whether an enum is defined in an assembly. Pin
0x3c04-Jun-09 1:43
0x3c04-Jun-09 1:43 
AnswerRe: How to figure out whether an enum is defined in an assembly. Pin
S. Senthil Kumar4-Jun-09 2:15
S. Senthil Kumar4-Jun-09 2:15 
GeneralRe: How to figure out whether an enum is defined in an assembly. Pin
_AnsHUMAN_ 4-Jun-09 20:11
_AnsHUMAN_ 4-Jun-09 20:11 
GeneralRe: How to figure out whether an enum is defined in an assembly. Pin
S. Senthil Kumar4-Jun-09 20:41
S. Senthil Kumar4-Jun-09 20:41 
QuestionOracle connection problem in C# Pin
mariamkhaqan3-Jun-09 21:59
mariamkhaqan3-Jun-09 21:59 
Questionhelp Pin
Rajdeep.NET3-Jun-09 21:50
Rajdeep.NET3-Jun-09 21:50 
AnswerRe: help [modified] Pin
musefan3-Jun-09 21:51
musefan3-Jun-09 21:51 
GeneralRe: help Pin
0x3c03-Jun-09 22:01
0x3c03-Jun-09 22:01 
GeneralRe: help Pin
musefan3-Jun-09 22:04
musefan3-Jun-09 22:04 
GeneralRe: help Pin
Rajdeep.NET3-Jun-09 22:31
Rajdeep.NET3-Jun-09 22:31 
GeneralRe: help Pin
musefan3-Jun-09 22:35
musefan3-Jun-09 22:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.