Dynamic in C# 4.0: Introducing the ExpandoObject

https://devblogs.microsoft.com/csharpfaq/dynamic-in-c-4-0-introducing-the-expandoobject/


Reflection comparison
https://www.red-gate.com/simple-talk/dotnet/.net-framework/a-defense-of-reflection-in-.net/


You can use KORM. Object relation mapper, which has provider for MsAccess Kros.KORM.MsAccess. KORM allow materialize ADO.NET classies like DbReader to IEnumerable. For example database.ModelBuilder.Materialize(reader)
https://www.nuget.org/packages/Kros.KORM.MsAccess/


Convert ExpandoObject to DataTable
http://www.fruitbatscode.com/net/c/convert-expandoobject-to-datatable


Adding properties and methods to an ExpandoObject, dynamically!
https://www.filipekberg.se/2011/10/02/adding-properties-and-methods-to-an-expandoobject-dynamicly/

A typical dynamic setup that creates a dynamic object and adds a static amount of properties might look like this:

//src filipekberg
dynamic person = new ExpandoObject();
person.Name = "Filip";
person.Age = 24;

What is interesting about the ExpandoObject is that it implements the interface: ]IDictionary<string, Object>

So what this means is that if we cast the person-object to an IDictionary we will be able to do some really cool stuff with it. The same code above but re-written to make use of the dictionary instead could look like this:

dynamic person = new ExpandoObject();
var dictionary = (IDictionary<string, object>)person;

dictionary.Add("Name", "Filip");
dictionary.Add("Age", 24);

By: |04/03/2019|categories: