LiteoDB和var List插入C#

时间:2018-01-09 15:38:51

标签: c# litedb

我试图使用LiteDB,我有以下内容:

var list2 = new List<Values>();

我一直在查看以下的LiteDB示例:

// Get customer collection
var col = db.GetCollection<Customer>("customers");

var customer = new Customer { Id = 1, Name = "John Doe" };

// Insert new customer document
col.Insert(customer);

// Update a document inside a collection
customer.Name = "Joana Doe";

col.Update(customer);

// Index document using a document property
col.EnsureIndex(x => x.Name);

有什么方法可以插入类型值列表,在我的情况下它会是:var list2 = new List();

我似乎无法找到以这种方式插入的任何地方。

谢谢,

1 个答案:

答案 0 :(得分:0)

这对我有用!!

var col = db.GetCollection<Values>("customers");
col.Insert(list2);

谢谢,