I have an API that can returns multiple things that I don't know in advance so I have to put as return type System.Object
.
I have some problems for some types. Like when it returns different objects its fine but when it returns an System.Int32
, it doesn't work and tells me:
Cannot serialize parameter of type 'System.Int32' because it is not the exact type 'System.Object' in the method signature and is not in the known types collection.
Any idea ?
I know we can use ServiceKnownType but I'd like to know if there is other way to do it? I would need all the existing types (int, bool, string, etc..) in this ...