SOVLBD1

VbNet · Console

/Program.vb

Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Data
Imports System.Xml
				
Public Module Module1
	Public Sub Main()
		Dim NoticeTable As New DataTable("NTable")
        NoticeTable.Columns.Add("Name", GetType([String]))

        Dim row1 As DataRow = NoticeTable.NewRow()
        row1("Name") = "John"
        NoticeTable.Rows.Add(row1)

        Dim row2 As DataRow = NoticeTable.NewRow()
        row2("Name") = "Sally"
        NoticeTable.Rows.Add(row2)
		
		 Dim row3 As DataRow = NoticeTable.NewRow()
        row3("Name") = "Paul"
        NoticeTable.Rows.Add(row3)

        Dim row4 As DataRow = NoticeTable.NewRow()
        row4("Name") = "Adam"
        NoticeTable.Rows.Add(row4)

        Dim myNegativeList As New List(Of ListItems)
        Dim list1 As New ListItems()
        list1.Name = "John"
        list1.Amount = 5
        myNegativeList.Add(list1)

        Dim list2 As New ListItems()
        list2.Name = "Sally"
        list2.Amount = 100
        myNegativeList.Add(list2)

        Dim result = From dr In NoticeTable.Rows
                     Where Not myNegativeList.Any(Function(x) x.Amount >= 15 AndAlso x.Name = dr("Name"))
                     Select dr("Name")

        For Each x In result
            Console.WriteLine(x)
        Next
	End Sub
End Module


Class ListItems
    Public Name As String
    Public Amount As Decimal
End Class
;