c# todatatable nullable code example
Example: c# todatatable nullable
<Extension()>
Public Function HasNull(dataTable As DataTable) As Boolean
If dataTable Is Nothing Then
Throw New ArgumentNullException("dataTable must be initialized", "dataTable")
End If
Dim allColumns = dataTable.Columns.Cast(Of DataColumn).ToList() ' materialize
Dim hasNullField As Boolean = dataTable.AsEnumerable().
Any(Function(row) allColumns.Any(Function(c) row.IsNull(c)))
Return hasNullField
End Function