title: Set default value for NULL in datatable
body: <p>I have the following codes, which I created as extension for datatable in my project. It actually worked. Just wonder if there is any optimization can be made through. Thanks. =)</p>
  
  <p>I understand this question should somehow belong to <a href="https://codereview.stackexchange.com/questions/58024/set-default-value-for-null-in-datatable">CR</a>. Just ask through.</p>
  
  <pre><code>&lt;Extension()&gt;
  Public Function HasNull(ByVal dataTable As DataTable) As Boolean
      For Each column As DataColumn In dataTable.Columns
          If dataTable.Rows.OfType(Of DataRow)().Any(Function(r) r.IsNull(column)) Then
              Return True
          End If
      Next
      Return False
  End Function
  
  &lt;Extension()&gt;
  Public Function SetDefaultForNull(ByVal dataTable As DataTable) As DataTable
      For Each row As DataRow In dataTable.Rows
          For Each col As DataColumn In dataTable.Columns
              Dim value As Object = row(col)
              If IsDBNull(value) Then
                  Dim dataType As String = col.DataType.ToString
  
                  Select Case dataType
                      Case "System.DateTime"
                          value = New DateTime
                      Case "System.Decimal", "System.Int16", "System.Int32", "System.Int64"
                          value = 0
                      Case "System.String"
                          value = String.Empty
                      Case "System.Boolean"
                          value = False
                      Case Else
                          value = 0
                  End Select
                  row(col) = value
              End If
          Next
      Next
      Return dataTable
  End Function
  </code></pre>