-
Type: Improvement
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 1.1
-
Component/s: None
-
None
Visual Studio 2010, Target Framework .NET 3.5 (driver 1.1 - both official API and built from the latest sources).
This code cannot be compiled:
void TestCompilerError()
{ var bsonArray = new MongoDB.Bson.BsonArray(); var update = MongoDB.Driver.Builders.Update.AddToSetEach("Name", bsonArray); }Error: The call is ambiguous between the following methods or properties: 'MongoDB.Driver.Builders.Update.AddToSetEach(string, System.Collections.Generic.IEnumerable<MongoDB.Bson.BsonValue>)' and 'MongoDB.Driver.Builders.Update.AddToSetEach(string, params MongoDB.Bson.BsonValue[])'
The couple of methods were apparently added for convenience in some cases. But it also makes problems in other cases. Perhaps the issue was known and the choice was done. If not, perhaps it makes sense to review and revise this API.
(N.B. Just in case, this case of ambiguity is different from https://jira.mongodb.org/browse/CSHARP-280)