当我使用的第一个代码,它完美地给出单词DB插入元素字符串列表
collection.Find(new BsonDocument()).ForEachAsync(X => Console.WriteLine(X.GetElement("word").Value));
但是当我尝试把所有“字” s转换为字符串列表以获得单个元件,但给出ArgumentOutOfRangeException
错误。
collection.Find(new BsonDocument()).ForEachAsync(X => wordStringList.Add(X.GetElement("word").Value.ToString()));
Console.WriteLine(wordStringList[0]);
我该如何解决这个问题,谢谢。