0

I'm in the process of converting VB to C#.Net for my company. In order to do this more easily, I have option strict ON. I am trying to resolve a late binding on the following code. Row is considered an OBJECT by the compiler. I've never written code in this fashion (someone else's work). Here is the code.

        Dim items As List(Of Contact) = ContactsTable.GetChanges.DataTableToList(Of Contact)
    'Dim row As DataRow = Nothing
    Dim modifiedRows As DataRowCollection = From row In ContactsTable.Rows
                       Where row.RowState = DataRowState.Modified Or row.RowState = DataRowState.Added

1 Answers1

0

There was no way to modify the existing code. The next best option was to recode it using a "For each" loop.

        Dim modifiedRows As DataRowCollection = Nothing
    For each row As DataRow In ContactsTable.Rows
        If row.RowState = DataRowState.Modified Or row.RowState = DataRowState.Added Then
            modifiedRows.Add(row)
        End If
    Next