4 ms·
Cool. Whats is the use-case? Edit - I hate to bitch about downvotes (as per http://ycombinator.com/newsguidelines.html http://ycombinator.com/newsguidelines.ht
by random42 15y ago
Cool. Whats is the use-case?
Edit - I hate to bitch about downvotes (as per http://ycombinator.com/newsguidelines.html http://ycombinator.com/newsguidelines.html), but can the downvoters to my comments in the thread, please respond, why the downvotes? Are my comments Off-Topic, rude or not adding to the discussion? Since, I am genuinely curious about all my queries.
- lukencode 15y agoThere are a couple of places in .net where json can be deserialized into a c# class you provide, for example posting json to an asp.net mvc controller action. I find it is a massive pain to go through and create the classes manually.
- random42 15y agoJust to clarify, you mean that a json object can be deserialized into an object of the c# class, right? or just the class definition (as done by the site)? If latter, how do you use the class definition generated dynamically? (without the values, that is)
- xpaulbettsx 15y agoThis generate strong types from example JSON messages, and there are handy methods in C# that let you take a JSON string and parse it as a given class. This way, other devs know what fields to expect in the JSON message and saves them time on digging through the raw JSON.
- random42 15y agoI understand the benefits of object oriented approach, vs the free formed JSON. Is it possible to create class dynamically in C#, or is it supposed to be one time effort (and the tool does it automatically it, as opposed to doing it manually)?
- tianyicui 15y agoIt is possible to create class dynamically in C#. Although I don't know whether this library is doing it.
- barrydahlberg 15y agoTypically with something like this it will be a one time effort because the code produced is what enables the development time tools like intellisense. .Net does have run time code generation options but unfortunately we don't have support in the tool chain to tie them back to these sorts of tools.
- jonathankeith 15y agoDynamic support is present in .NET/C# as of version 4.0. Consuming JSON in applications written or currently running on prior versions leaves one with little choice than writing static types to deserialize to.