[CSHARP-19] Add support for anonymous types Created: 26/Feb/10  Updated: 19/Oct/16  Resolved: 27/Apr/10

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: Felipe Lima Assignee: Sam Corder
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

All



 Description   

The C# driver should include support for anonymous types when manipulating documents.
Example:
var mongo = new Mongo();
mongo.Connect();
var db = mongo["testdb"];
var col = db["categories"];
var doc = new Document();
doc.Append("Name", new

{ Foo = "Bar" }

);
col.Insert(doc);

The same should work for querying, updating and deleting.



 Comments   
Comment by Steve Wagner [ 27/Apr/10 ]

This is included in the next public release.

Comment by Felipe Lima [ 01/Mar/10 ]

Just implemented this feature in my fork of the driver at git://github.com/felipecsl/mongodb-csharp.git

Comment by Sam Corder [ 26/Feb/10 ]

This will be a good feature to have. I'm going to bump the priority down because you can already do something like it with object initializers.

var doc = new Document()"x", 1},{"y",2;

Generated at Wed Feb 07 21:35:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.