How CLR identifying attributes RRS feed

  • Question

  • Can some one please help me understand,how a CLR is identifying the attributes which we write for a class or a method.Whats internally happening when CLR reading the attribute.
    For Instance,how CLR is differentiating between [Serializable] and [Non-Serializable] attributes when serializing a class.
    I am trying to present a paper in my office,which needs this input.

    Looking forward for a quick response from someone

    Monday, March 31, 2008 4:34 AM


  • Hi Arun,


    I'll try briefly describe what is going on inside CLR.


    First at all, C# compiler generates information necessary for custom attribute instantination and writes this info in metadata (provides attribute type and parameters).


    Then, for instance, serialization functionality reads [Serializable] and [Non-Serializable] attributes from methods/properties (by reading method metadata and retrieving attribute instance).


    Please, let me know if you have any other questions.



    Monday, March 31, 2008 9:33 AM