>>>var _CSVTests = from cs in db.CSVTests >>> select cs; >>> >>>foreach (CSVTest tst in _CSVTests) >>> { >>> >>> In here I want to iterate over each column in each record and >>> if it is not equal to NULL I want to do something with the value, >>> such as insert that value into another table. >>> >>> } >>>>>>
>> var fields = typeof(CSVTest).GetProperties(); >> foreach (CSVTest tst in _CSVTests) >> { >> foreach (var field in fields) >> { >> object v = field.GetValue(tst, null); >> if ( v == null ) >> // ... >> } >> } >>>>Maybe copying to a datatable would be easier. Check ObjectShredder< T >: