Closed AKTheKnight closed 5 years ago
Well timing is perfect because I'm implementing #5 right now.
It would be really nice to support anonymous types, but don't you think the interface would become a little more difficult to implement?
I think by using T Deserialize<T>(string content, T type);
as the interface method, people can implement is as below if they wanted (This passes all the tests, I just keep it as a separate method so we take advantage of any possible library benefits to anonymous deseralization):
public T Deserialize<T>(string content, T type)
{
return Deserialize<T>(content);
}
Good news! There is no need to change the interface at all to implement this, as of c7916538cf687f25f89db6bf1242e6923283c9fe @AKTheKnight I see that you've made PR #6 and most of these changes won't be necessary, and so I will take only the tests ok?
Yes of course, feel free to take whatever :)
@AKTheKnight merged your PR with my own code and it's like this: ab94fd2da1f139dda0f116f3f2144140c5a94ed6 But if I merge it, you won't appear as a contributor. If you would like so, please fix PR #6 and I will merge it instead :)
https://www.reddit.com/r/dotnet/comments/b2nufu/restful_api_access_made_simple_with/eiv5er9
Based on the reddit comment linked below, it would be good to add support for anonymous types such as below:
Not sure if you would like this to be done as:
An overload like this:
Or as a new method:
Either way it'll mean adding a new method to the IDeserializer, not sure what your thoughts are on that?