I have a datatable which contain a column Path of file. Now i want to filter file Path is exist or not.
DataTable.Select(File.Exists(ColumnsName))
Would you please help me how may i filter.
I have a datatable which contain a column Path of file. Now i want to filter file Path is exist or not.
DataTable.Select(File.Exists(ColumnsName))
Would you please help me how may i filter.
You can filter datatable by file path column by checking existence using File.Exists
var result = dataTable.AsEnumerable().Where(r=>File.Exists(r.Field<string>("Path"));
DataSets are a pretty old concept in .NET so to use LINQ you need a bit of extra syntax:
dataTable.Rows.Cast<DataRow>().Select(row => File.Exists(row.Field<String>(columnName)))
This will return an IEnumerable<Boolean>
that determines if the files exist.