I understand that this contradicts the strictly typified nature of C #, but I find that when working with dynamic objects in the language, some of the most useful functions commonly found in JavaScript or PowerShell are simply not practical.
For example, the following C # code will not work at runtime, and this is obvious.
dynamic x = 1.0;
int y = x;
But this makes C # dynamic functions quite limited when working with weakly typed data, such as those created by JSON or CSV payloads, where subtle variations in presentation can lead to completely different runtime behavior.
What I'm looking for is something that will behave like a VBA / VBScript type Variant. I assume that it is possible to get a type from DynamicObjectwhich would wrap primitive values, such as Int32, Stringetc., and perform appropriate drops at runtime. I did something similar with "null" values in dynamic contexts.
But is something like this already installed? I looked at GitHub or Codeplex to no avail, but it's hard to find. Before I start with what, in my opinion, will be a rather complicated class, I want to make sure that I do not waste my time.
About the practicality of all this
, #, . , , , , COM.
, , , "" , , . - . , , IDisposable using , .
, -, .