The constructor may not get executed because the attribute instance is actually serialized with the type. It's my understanding that only when you try to use the attribute that it gets deserialized. When something deserialzed I don't think it ever calls the constructor. Anyone please correct me if I'm wrong :)
Hope that helps, Fred > Hi All, > > I have written a custom attribute and applied it to the public > fields/properties of a class. This attribute actually maintains certain > data > per **Type**. > > In the constructor of this attribute class I am adding data to a static > HashTable object, declared in the attribute class (Certainly, after > checking > that it does not already exist for the given Type) > > For example : > > public class A > { > [MyCustom("some data...")] > public int i; > > [MyCustom("some data...")] > public string Name > { > get { return this._ColName; } > set { this._ColName = value; } > } > } > > I expect the attribute constructor to have already executed by the time I > create the first instance of the class A. But it is not happening. > > > Can anybody tell me when does the constructor for the attribute gets > executed? > > Thanks in advance > > Regards, > Girish Jain > > _________________________________________________________________ > Redefine team work. Discover your true potential. > http://www.microsoft.com/india/office/experience/ With the MS product > suite. > > =================================== > This list is hosted by DevelopMentorŪ http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com > =================================== This list is hosted by DevelopMentorŪ http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com