I am aware about the problem when creating custom collections that inherits from List<T>
or ICollection<T>
with additional custom properties:
public class MyCollection: List<int>
{
public string MyCustomProperty { get; set; }
}
As I know, such collection will passed throw WCF as ArrayOfInt and WCF will not serialize my custom property. The solution is to create the wrapper class that will manage collection inside and will have a custom property.
I want to make a nicer workaround for my needs...does IEnumerable<T>
will have the same problem?
public class MyCollection: IEnumerable<int>
{
/**************/
/* Code that implements IEnumerable<int> and manages the internal List<T> */
/* I know I will not able to cast it to List<T>, but I don't need it. */
/* If I will need it, I will implement cast operators later */
/**************/
public string MyCustomProperty { get; set; }
}
Will the class above pass throw WCF include MyCustomProperty value?
Thanks