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 main () { } class Viseshank
Int _intVal; Int _maxVal; Get specialty for public specialINTIS (// instant peninsula _maxwal = GetAttribute ("maxwale")
[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
Post a Comment