Search code examples
.netwcfserializationsoapwsdl

Is a List of objects Guaranteed to Maintain Its Order When Passed to Service Method?


I have a WCF service method that accepts a List of objects. For this example, lets say that 'T' is of type Car. The client will ensure that the List is in the correct order and then pass that List as a parameter to the service method.

For example, the service method looks like this:

    public void ProcessCars(List<Car> cars)
    {
        ...
    }

The client would call the service method like this:

client.ProcessCars(cars);

Is it safe for me to assume that 100% of the time the List sent from the client will maintain the same order when it is deserialized on the service side? Is there ever a time when this wouldn't be the case?

Thanks.


Solution

  • While you are using the built in serializer/deserializer its remains in the same order.
    Check this: http://msdn.microsoft.com/en-us/library/aa347850.aspx