开发者

Check if WPF DataRowView contains a column

I can get the value of a column in a DataRowView using

DataRowView row;
object value = row["My开发者_开发知识库Column"];

of course, if there is no "MyColumn" in the DataRowView, this code throws an exception.

How do I check in advance, if the row contains "MyColumn"? Sadly there is no row.Contains("MyColumn") on DataRowView.


You can use this

dataRowView.Row.Table.Columns.Contains("MyColumn")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜