I am trying to create a property of type IEnumerable<AnotherDynamicType>
using Reflection.Emit
.
I have a helper method that adds properties fine, accepting a Type as input:
public void AddPropertyTypeBuilder typeBuilder, string propertyName, Type type) {
....
}
This can be called in this manner:
AddProperty(typeBuilder,"MyPropertyName",typeof(string));
However now I wish to add a property to the class:
public IEnumerable<AnotherDynamicType> MyList {get;set;}
How do I define the "Type" of this property for the call, given that the target AnotherDynamicType
is also dynamically created?
The following doesn't compile:
AddProperty(typeBuilder,"MyPropertyName",typeof(IEnumerable<typeof(anotherDynamicType)>));
Aucun commentaire:
Enregistrer un commentaire