I can’t use the example here because it’s specific to the structure the asker was using.
Currently, I’m going:
PropertyInfo[] props = this.GetType().GetProperties();
foreach (DataColumn dataColumn in dataAsDataRow.Table.Columns)
if( !props.Any(p => p.Name == dataColumn.ColumnName) )
...
I’d much rather have something in one line, such as:
foreach (DataColumn dataColumn in dataAsDataRow.Table.Columns.Cast<DataColumn>.Except(props) )
...
Any ideas?
Or the slightly optimized version (as always, depending on the runtime number of columns, properties, etc, etc):