I have a datatable. I am getting distinct value of column from below code.
AllFields
is my datatable.
var distinctIds = AllFields.AsEnumerable()
.Select(s => new
{
id = s.Field<string>(ColumnName),
})
.Distinct()
.ToList();
however I want to get distinct value of a column with where condition on same column. I have tried below thing.
var distinctIds = AllFields.AsEnumerable()
.Select(s => new
{
id = s.Field<string>(ColumnName),
})
.Distinct()
.Where(f => f.id.Contains(TxtStringSearchInput.Text))
.ToList();
it is showing me below error on run time.
nullreferenceexception error . {"Object reference not set to an instance of an object."}