+6  A: 

Sure this is possible. Attributes are stored in Metadata and this is easily accessible during construction of an object.

public class Foo { 
  [Something]
  public int Field1;

  public Foo() {
    FieldInfo fi = typeof(Foo).GetField("Field1");
    SomethingAttribute si = (SomethingAttribute)fi.GetCustomAttribute(typeof(SomethingAttribute),false)[0];
    // grab any Custom attribute off of Fiield1 here
  }
}
JaredPar
What I sort of want to be able to do.class SpecialInt{ int _intVal; int _maxVal; public SpecialInt() { //Get attribute for the instantiated specialint _maxVal = GetAttribute("MaxValue") } }class main(){ [MaxValue(100)] SpecialInt sInt; public main() { sInt = new SpecialInt() }}And have the constructor for SpecialInt know the attributes applied to it.
+1  A: 

You can test them from anywhere. Attributes are inserted into the metadata for the type when you compile it. A type doesn't need to be instantiated to access field properties.

Groo