reflection - Using Custom Attributes from Within Constructor - C# -


I want to use custom attributes on the field in the classroom. I want to use the attributes placed on the field during the field constructor. Is this possible?

Edit 28.06.09 Below are some kind of pseudo-code

class Viseshank

{

  Int _intVal; Int _maxVal; Get specialty for public specialINTIS (// instant peninsula _maxwal = GetAttribute ("maxwale")  

}}

class main ()

{

  [MaxValue (100)] Speshlistaiaianti; Public main () {sInt = new SpecialInt ()}  

}

Sure it is possible that the attributes are stored in metadata and it can be easily accessible during the creation of an object.

  public square fu {[some] public int field 1; Public Foo () {FieldInfo fi = typeof (Foo) .GetField ("Field 1"); Some facts = (some object) fi.GetCustomAttribute (type (some object), wrong) [0]; // Close any custom attribute Fiield1}}  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -