开发者

Check if WPF DataRowView contains a column

开发者 https://www.devze.com 2023-01-29 22:32 出处:网络
I can get the value of a column in a DataRowView using DataRowView row; object value = row[\"My开发者_开发知识库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

精彩评论

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