new keyword to generate a generic object has a gotcha, the key value must be a property and not a string.
Dictionary<string, object> to achieve the same effect, although it is more verbose.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
new keyword to generate a generic object has a gotcha, the key value must be a property and not a string.
var query = new
{
// Won't work, must be $in without quotes, however, using a $ is not
// valid in a property definition.
"$in" = new List<string> { "123" }
};
Dictionary<string, object> to achieve the same effect, although it is more verbose.
var query = new Dictionary<string, object>
{
{ "$in", new List<string> { "123" } }
};