views:

116

answers:

2

Hey all..

I have a call (POST) to a web service that returns a type IList<>. I suspect that this type is not serialized properly because I get the following error: "A circular reference was detected while serializing an object of type......"

Can I only work with arrays? Make another method that returns only an array? I would rather not duplicate my methods just to work with JQuery.

Anyone seen this?

Thanks,

Nick

A: 

Your IList probably has a collection of it's own. You can serialize IList<>'s to formats like JSON with the Json class.

rball
A: 

You can't return an Interface because the contract required to support all the types that could possibly support the interface is infinite.

Just because object Car and object Motorcycle support IVehicle, when deserializing the client would not know what type to create.

Same with returning derived classes for the same reasons.

Chad Grant