BsonDocument bd = new BsonDocument();
BsonElement be = new BsonElement("width", 123);
BsonElement be1 = new BsonElement("height", "ddd"); bd.Add(be);
bd.Add(be1);
——————————————————————————
if (bd["width11"] == null)
{
string ss = "";
}
else
{
string ss = bd["width11"].ToString();
}
这样报错!
———————————————————————————— private static bool IsExist(BsonDocument bd,string el)
{
bool isExist = false;
IEnumerable<string> strNames = bd.Names;
foreach (string s in strNames)
{
if (s == el)
{
isExist = true;
}
}
return isExist;
}
这样感觉效率不高!
————————————————————————————BsonDocument 有自带的方法能够判断 Element是否存在???另外那位有BsonDocument 的相关教程和文档发下地址也可以。谢谢了!
BsonElement be = new BsonElement("width", 123);
BsonElement be1 = new BsonElement("height", "ddd"); bd.Add(be);
bd.Add(be1);
——————————————————————————
if (bd["width11"] == null)
{
string ss = "";
}
else
{
string ss = bd["width11"].ToString();
}
这样报错!
———————————————————————————— private static bool IsExist(BsonDocument bd,string el)
{
bool isExist = false;
IEnumerable<string> strNames = bd.Names;
foreach (string s in strNames)
{
if (s == el)
{
isExist = true;
}
}
return isExist;
}
这样感觉效率不高!
————————————————————————————BsonDocument 有自带的方法能够判断 Element是否存在???另外那位有BsonDocument 的相关教程和文档发下地址也可以。谢谢了!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货