Let in query : Let « LINQ « VB.Net






Let in query

 

Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.Linq
Imports System.Text
Imports System.Globalization

Module Example
   Public Sub Main()
      Dim ArrayA As Integer() = New Integer() {1, 2, 3, 4}
      Dim ArrayB As Integer() = New Integer() {1, 2, 3, 4}

      Dim Squares = From QueryA In ArrayA _
         From QueryB In ArrayB _
         Let TheSquare = QueryA * QueryB _
         Where TheSquare > 4 _
         Select QueryA, QueryB, TheSquare

      For Each ThisSquare In Squares
         Console.WriteLine(ThisSquare.QueryA.ToString() + " * " + _
            ThisSquare.QueryB.ToString() + " = " + _
            ThisSquare.TheSquare.ToString())
      Next


   End Sub 
End Module 

   
  








Related examples in the same category