Language: Add FieldOrDefault method

This commit is contained in:
Jonathan Jenne 2023-02-22 11:07:34 +01:00
parent ad5443adae
commit fd0876a1cb

View File

@ -19,6 +19,16 @@ Public Module DataTableEx
End Try
End Function
<Extension()>
Public Function FieldOrDefault(Of T)(pRow As DataRow, pFieldName As String, Optional pDefaultValue As T = Nothing) As T
Return ItemEx(pRow, pFieldName, pDefaultValue)
End Function
<Extension()>
Public Function FieldOrDefault(Of T)(pRow As DataRow, pFieldIndex As Integer, Optional pDefaultValue As T = Nothing) As T
Return ItemEx(pRow, pFieldIndex, pDefaultValue)
End Function
<Extension()>
Public Function First(pTable As DataTable) As DataRow
Try