如何获取EntityKey的值?
我试过了:
字符串x= Customer.EntityKey.EntityKeyValues.Value;
字符串x= Customer.EntityKey.EntityKeyValues.Value.ToString();
字符串x= Customer.EntityKey.EntityKeyValues;
字符串x= Customer.EntityKey.EntityKeyValues.ToString();
以:对象引用未设置为对象的实例而结束。
请帮帮忙。谢谢
发布于 2010-01-12 22:24:19
正如您报告的那样,您将获得一个Object reference not set to an instance of an object,您可能想要检查null引用;
String x = (Custormer == null ? null :
Customer.EntityKey == null ? null :
Customer.EntityKey.EntityKeyValues.Length == 0 ? null :
Customer.EntityKey.EntityKeyValues[0].Value);https://stackoverflow.com/questions/2049479
复制相似问题