I have Restful wcf service that returns the following class, but the Total and Count fields become 0 when it reaches the client side. But they have the correct values on the server side.
public class Groups : List<Group>
{
private int total;
private int start;
/// <summary>
/// Total number of Groups in the result set irrespective of the paging
/// </summary>
public int Total
{
get
{
return total;
}
set
{
total = value;
}
}
/// <summary>
/// Index (in the full non paged result set) of the first group in the set.
/// </summary>
public int Start
{
get
{
return start;
}
set
{
start = value;
}
}
}
The problem is when client receives the return value from the service call, the Start and Total fields are always 0. But when debug the service's code it returns the correct value but by the time it comes to the client side they have become 0. But the List of the base class is returned properly (it doesn't get lost)
When I return the Group class, which is a simple class (not derived from anything), it is also returned properly.
The problem happens only with the Public fields of the groups collection class.
So I think this is a deserialization issue and tried adding the [Datamember] attribute, [seriaizable] and implementing ISerializable but nothing worked.
Any help will be greatly appreciated.
Thanks