I'm asking your help to know if exists a fast method to check if all the values in a specific column of a DataTable/Datagridview are DateTime or numbers.
I'm trying to make a generic method to put specific formats in any column in a DGV.
I have information from TEXT files / Excel or XML files without previously data type definition
Thanks!
You can bury the loop in an extension method. The end result will need a loop somewhere, though, even if the loop is hidden inside Linq operations. For example, you could write this extension method:
Then you can call it like this:
This is fast in the sense that it does not check any more rows than necessary, and it does not continue checking a given type after it has been ruled out.