tags:

views:

346

answers:

1

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.

+6  A: 

You'll need to use the CollectionDataContract attribute to handle this in WCF.

[CollectionDataContract] 
public class MyCollection : IDisposable, List<MyClass> 
{
}

Marc

marc_s
+1 and my answer is deleted :)
ArsenMkrt