❔ Hello I am new to C#, I dont understand this error:
I have a insert method that adds to queue:
and then in a thread loop:
but I'm getting this error:
_insertQueue.Enqueue(new object[] { database, collection, document });_insertQueue.Enqueue(new object[] { database, collection, document });and then in a thread loop:
while(_insertQueue.Count > 0)
{
var items = _insertQueue.Dequeue();
var database = items[0];
var collection = items[1];
var document = items[2];
var db = _mongoClient.GetDatabase(database);
var col = db.GetCollection<BsonDocument>(collection);
col.InsertOne(document);
}while(_insertQueue.Count > 0)
{
var items = _insertQueue.Dequeue();
var database = items[0];
var collection = items[1];
var document = items[2];
var db = _mongoClient.GetDatabase(database);
var col = db.GetCollection<BsonDocument>(collection);
col.InsertOne(document);
}but I'm getting this error:
error CS0021: Cannot apply indexing with [] to an expression of type 'object'error CS0021: Cannot apply indexing with [] to an expression of type 'object'