Operaciones cuantificadoras en LINQ

Estos operadores devuelven un valor booleano, es decir, verdadero o falso cuando algunos o todos los elementos de una secuencia satisfacen una condición específica.

Operador Descripción Sintaxis de expresión de consulta de C # Sintaxis de expresión de consulta de VB
Todas Devuelve un valor 'Verdadero' si todos los elementos de una secuencia satisfacen una condición de predicado No aplica Agregar ... en ... en todos (...)
Ninguna Determina al buscar en una secuencia si algún elemento de la misma satisface una condición especificada No aplica Agregar ... en ... en cualquier ()
Contiene Devuelve un valor 'Verdadero' si encuentra que un elemento específico está allí en una secuencia si la secuencia no contiene ese elemento específico, se devuelve un valor 'falso' No aplica No aplica

Ejemplo de método de extensión All - All (Of TSource)

VB

Module Module1

   Sub Main()

      Dim barley As New Pet With {.Name = "Barley", .Age = 4}
      Dim boots As New Pet With {.Name = "Boots", .Age = 1}
      Dim whiskers As New Pet With {.Name = "Whiskers", .Age = 6}
      Dim bluemoon As New Pet With {.Name = "Blue Moon", .Age = 9}
      Dim daisy As New Pet With {.Name = "Daisy", .Age = 3}

      Dim charlotte As New Person With {.Name = "Charlotte", .Pets = New Pet() {barley, boots}}
      Dim arlene As New Person With {.Name = "Arlene", .Pets = New Pet() {whiskers}}
      Dim rui As New Person With {.Name = "Rui", .Pets = New Pet() {bluemoon, daisy}}

      Dim people As New System.Collections.Generic.List(Of Person)(New Person() {charlotte, arlene, rui})

      Dim query = From pers In people
                  Where (Aggregate pt In pers.Pets Into All(pt.Age > 2))
                  Select pers.Name

      For Each e In query
         Console.WriteLine("Name = {0}", e)
      Next

      Console.WriteLine(vbLf & "Press any key to continue.")
      Console.ReadKey()
	  
   End Sub

   Class Person
      Public Property Name As String
      Public Property Pets As Pet()
   End Class

   Class Pet
      Public Property Name As String
      Public Property Age As Integer
   End Class
   
End Module

Cuando el código anterior en VB se compila y se ejecuta, produce el siguiente resultado:

Arlene 
Rui 

Press any key to continue.

Ejemplo de cualquier método de extensión

VB

Module Module1

   Sub Main()

      Dim barley As New Pet With {.Name = "Barley", .Age = 4}
      Dim boots As New Pet With {.Name = "Boots", .Age = 1}
      Dim whiskers As New Pet With {.Name = "Whiskers", .Age = 6}
      Dim bluemoon As New Pet With {.Name = "Blue Moon", .Age = 9}
      Dim daisy As New Pet With {.Name = "Daisy", .Age = 3}

      Dim charlotte As New Person With {.Name = "Charlotte", .Pets = New Pet() {barley, boots}}
      Dim arlene As New Person With {.Name = "Arlene", .Pets = New Pet() {whiskers}}
      Dim rui As New Person With {.Name = "Rui", .Pets = New Pet() {bluemoon, daisy}}

      Dim people As New System.Collections.Generic.List(Of Person)(New Person() {charlotte, arlene, rui})

      Dim query = From pers In people
                  Where (Aggregate pt In pers.Pets Into Any(pt.Age > 7))
                  Select pers.Name

      For Each e In query
         Console.WriteLine("Name = {0}", e)
      Next

      Console.WriteLine(vbLf & "Press any key to continue.")
      Console.ReadKey()
	  
   End Sub

   Class Person
      Public Property Name As String
      Public Property Pets As Pet()
   End Class

   Class Pet
      Public Property Name As String
      Public Property Age As Integer
   End Class
   
End Module

Cuando el código anterior en VB se compila y se ejecuta, produce el siguiente resultado:

Rui

Press any key to continue.