views:

36

answers:

2

Can I have a webservice method that returns List<List<MyObject>> in .net?

A: 

Yes. You can. You can return pretty much any object. And I've done exactly this in several projects.

David Stratton
+1  A: 
[DataContract]
public class MyObject
{
}

[ServiceContract]
public interface IMyService
{
    [OperationContract]
    List<List<MyObject>> ServiceOperation();
}

public class MyService : IMyService
{
    public List<List<MyObject>> ServiceOperation()
    {
        return new List<List<MyObject>>();
    }
}
John Saunders
+1 for providing the example.
David Stratton