2

EntityKeyの値を取得する方法は?

私は試した:

文字列x=Customer.EntityKey.EntityKeyValues [0] .Value;

文字列x=Customer.EntityKey.EntityKeyValues [0] .Value.ToString();

文字列x=Customer.EntityKey.EntityKeyValues;

文字列x=Customer.EntityKey.EntityKeyValues.ToString();

最終的に:オブジェクト参照がオブジェクトのインスタンスに設定されていません。

助けてください。ありがとう

4

1 に答える 1

3

を取得していると報告したので、参照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);
于 2010-01-12T14:24:19.250 に答える