Reputation: 14667
I have a custom collection which i want to expose from the WCF web service.
[DataContract( Name = "MyClass")]
public class MyCollection : IDisposable, List<MyClass>
{
}
When I use [DataContract( Name = "MyClass")]
attribute it gives error
Type MyCollection is an invalid collection type since it has DataContractAttribute attribute.
Upvotes: 14
Views: 3234
Reputation: 754488
You'll need to use the CollectionDataContract attribute to handle this in WCF.
[CollectionDataContract]
public class MyCollection : IDisposable, List<MyClass>
{
}
Marc
Upvotes: 29