Using C# Dynamic with MongoDB

Nice example of using Dynamic in manipulation with  MongoDB-CSharp document



Document post = new Document(); 
post["Published"] = DateTime.UtcNow; 
DateTime published = ((DateTime)mongo_post["Published"]).ToLocalTime();


With Dynamic

dynamic post = new Document(); 
post.Published = DateTime.UtcNow; 
DateTime published = mongo_post.Published.ToLocalTime();


Dynamic document implementation


Thanks to Scott Watermasysk


Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at