Click here to Skip to main content
15,891,529 members
Articles / Programming Languages / C#

Creating a Simple Dynamic Dictionary in C#

Rate me:
Please Sign up or sign in to vote.
2.86/5 (8 votes)
13 May 2020MIT2 min read 33.3K   235   8  
This tip shows how to create a dynamic JavaScript-like "object" to be used in web pages and T4 templates.
With this tip, I will demonstrate creating a JavaScript-like dynamic object in C# with arbitrary gettable and settable fields using .NET's DLR technology. This allows for readable and writable/creatable fields on arbitrary objects without having to create a strongly typed object. It is especially useful in ASP.NET pages and T4 templates to enhance readability and flexibility.

Views

Daily Counts

Downloads

Weekly Counts

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
United States United States
Just a shiny lil monster. Casts spells in C++. Mostly harmless.

Comments and Discussions