Skip to content

Meta data and attribute

George George

Asked May 10, 2008, 11:44 PM EDT2 answers
Share
LinkedInX

Hello everyone,


Two questions related to meta data and attribute,

1.

.Net built-in and user defined attribute are both defined in meta data portion of assembly or not? In my past experience, I think method/class level attribute is only used to facilitate the method/class IL generation, and will not exist in final assembly file. Any comments?

2.

If .Net built-in and user defined attribute exist in the final meta data part of assembly, is it possible to use reflector to see them? (I have tried but can not find.)


thanks in advance,
George

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Bechir Bejaoui
    0
    Using attributes is an alternative to enable programmer embed  customized meta data within a given assembly. other entities classes for example have to reflect on them otherwise they become totaly ignored

    to exlore attribute you  may use reflection
    using System.Reflection;
    Assembly  a = Assembly.Load("AssemblyName");
    Type t = Type.GetType("a.typeName");
    Object[] Attributes = t.GetAttributes();
    and then you can get info about them

    you can make use of the ildasm.exe there is a useful short cut Ctrl + M that gives you some details about meta data within a given assembly
    0
  • 0

    Great reply, Bechir!

     

    I have tried that Ctrl+M shows Meta Info. I think Meta Info including attribute (i.e. attribute is a part of meta data information), and  meta data information should include more information beyond attribute, right?

     

    regards,

    George

    0