0

I have a C# object MyObject with a HashSet property. I serialise it client-side, and then send it via GET with parameters in the URI to a C# ApiController, which accepts the object as an argument:

public MyOtherObject Get([FromUri] MyObject obj) { ... }

This all worked absolutely fine using a List, but now that I'm using a HashSet, the client serialises and sends the object, but the server receives an empty HashSet.

Is there a key difference in the way that C#'s ApiController receives HashSets and Lists via URI?

Alec
  • 2,432
  • 2
  • 18
  • 28
  • 1
    How do you send it and how do you serialize it/deserialize it. – Bauss Oct 05 '15 at 09:09
  • what is the structure of `MyObject`? – Amit Kumar Ghosh Oct 05 '15 at 09:09
  • 2
    http://stackoverflow.com/questions/4192905/serializing-a-hashset – Dennis Oct 05 '15 at 09:13
  • @AmitKumarGhosh, the object is a POCO with a few primitive types and a couple of `HashSet`s, all as public properties. – Alec Oct 05 '15 at 11:05
  • @Bauss I should have been more specific: I'm not actually serialising; I'm parameterising by using RestSharp's "AddParameter" function, to put the object directly in the URI. At the other end, the object is deparameterised through whatever magic `FromUri` does. – Alec Oct 05 '15 at 11:06

0 Answers0