Hi,
I need to fetch all the properties of an anonmous type which can be written to.
eg:
var person = new {Name = "Person's Name", Age = 25};
Type anonymousType = person.GetType();
var properties = anonymousType.GetProperties(BindingFlags.Public | BindingFlags.Instance);
The problem is that all the properties have their "CanWrite" propert false. This is returned as true for non anonymous types.
I have also tried making a call to PropertyInfo.GetSetMethod() which returns null.
How can I check whether the property can be written to?
Edit:
Perhaps it would suffice to know if a type is anonymous or not. How do I find out if a type is anonymous using reflection?
Kind regards,