Accessing c# class properties like javascript language would make life a lot easier.
How we can do it in C#?
For example:
someObject["Property"]="simple string";
Console.WriteLine(someObject["FirstName"]);
Accessing c# class properties like javascript language would make life a lot easier.
How we can do it in C#?
For example:
someObject["Property"]="simple string";
Console.WriteLine(someObject["FirstName"]);
dynamic
keyword can be used insteadThis code would work
import System.Dynamic namespace.
You could derive every single class from
Dictionary<string, object>
. But then, you could simply take JavaScript instead of misusing C#.Here is how you can enable property-bag-like functionality in your classes by adding a few lines of code: