这是我的代码.可以在Linqpad中运行.
void Main(){
List<Object> listobj=new List<object>{
new object[]{"A01001","sucess","on"},
new object[]{"A01002","fail","off"}};
listobj.Dump();
var second = listobj.Cast<RowItem>();
second.Dump();
}
public class RowItem {
public string GOODS_ID { get; set; }
public string AUDIT_STATUS { get; set; }
public string APPLY_STATUS { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我想转换List<object>为List<RowItem>,但当我使用cast方法时,它返回一个错误cannot convert type 'System.Object[]' to class RowItem
这是可能的,还是有另一种方法来实现这一目标?
谢谢.
I have a script and I want to remove u'domain' and u from the list
from pymongo import MongoClient
client = MongoClient()
db = client.domains
collection = db.domain
find_document = collection.find({},{'domain': 1, '_id':0})
data = list(find_document.limit(2))
{myIds.push(myDoc.domain.str)})
print (data)
Run Code Online (Sandbox Code Playgroud)
The result is :
[{u'domain': u'allegacyhsa.org'}, {u'domain': u'americanhelpinghands.org'}]
Run Code Online (Sandbox Code Playgroud)
I want to print only the domain like :
['allegacyhsa.org','americanhelpinghands.org']
Run Code Online (Sandbox Code Playgroud)
Without u and {
Thank you in advance for your answer.