[2.0] Reflection question
please someone explain to me why the 3rd line of my code fails
Code:
TypeDescriptor.CreateProperty(typeof (Class1), "test", typeof (int));
Assert.IsNotNull(TypeDescriptor.GetProperties(typeof (Class1).GetProperty("test")));
Assert.IsNotNull(typeof (Class1).GetProperty("test"));
Re: [2.0] Reflection question
I can't claim to have got that far into reflection but that first line does NOT create a property named "test". It creates a property descriptor for a property named "test". The second line doesn't fail because it simply returns an empty PropertyDescriptorCollection. The third line does fail because Class1 has no property named "test".