Tried coding
Client = new MongoClient($"mongodb://{connectionParameters}");
List<dynamic> names = Client.ListDatabases().ToList()
.Select(x => new { name = x["name"].ToString() })
.OrderBy(x => x.name)
;
but the compiler shows error
Cannot implicitly convert type
'System.Linq.IOrderedEnumerable<>'
to
'System.Collections.Generic.List'.An explicit conversion exists (are you missing a cast?)
Not sure what the remedy is.
Also tried
List<string> names = Client.ListDatabases().ToList()
.Select(x => x["name"].ToString())
;
but also errored
Cannot implicitly convert type 'System.Collections.Generic.IEnumerable' to 'System.Collections.Generic.List'. An explicit conversion exists (are you missing a cast?)