I tried it and it does not serialize custom property. I just returned the entire class object from the service method. Result is still ArrayOfInt (i used List as container)
public class MyExtension: IEnumerable<int>
{
public string CustomString { get; set; }
private List<int> lst = new List<int>();
public void Add(int i)
{
lst.Add(i);
}
public IEnumerator<int> GetEnumerator()
{
return lst.GetEnumerator();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return lst.GetEnumerator();
}
}
I had to mark it as DataContract and every member as DataMember to have all the properties serialized.
<MyExtension xmlns="http://schemas.datacontract.org/2004/07/GetRequestTest" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<CustomString>sunny</CustomString>
<lst xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a:int>1</a:int>
</lst>
</MyExtension>