首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何获取EntityKey的值?

如何获取EntityKey的值?
EN

Stack Overflow用户
提问于 2010-01-12 22:10:33
回答 1查看 3.6K关注 0票数 2

如何获取EntityKey的值?

我试过了:

字符串x= Customer.EntityKey.EntityKeyValues.Value;

字符串x= Customer.EntityKey.EntityKeyValues.Value.ToString();

字符串x= Customer.EntityKey.EntityKeyValues;

字符串x= Customer.EntityKey.EntityKeyValues.ToString();

以:对象引用未设置为对象的实例而结束。

请帮帮忙。谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-01-12 22:24:19

正如您报告的那样,您将获得一个Object reference not set to an instance of an object,您可能想要检查null引用;

代码语言:javascript
复制
String x = (Custormer == null ? null :
              Customer.EntityKey == null ? null :
                Customer.EntityKey.EntityKeyValues.Length == 0 ? null :
                  Customer.EntityKey.EntityKeyValues[0].Value);
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2049479

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档