Query Date with Linq : Select « LINQ « VB.Net






Query Date with Linq

   

Imports System.IO
Imports System.Reflection
Imports System.Linq
Imports System.Xml.Linq

Public Class MainClass
   Public Shared Sub Main

        Dim y = Year(Now)
        Dim m = Month(Now)
        Try
            Dim MeetingDates(5) As Date
            For i = 0 To UBound(MeetingDates)
                MeetingDates(i) = New Date(y, m, CInt((Date.DaysInMonth(y, m) - 1) * Rnd() + 1))
            Next

            Dim CommonDates = From day2 In MeetingDates _
                              Order By day2 _
                              Select day2 Distinct
            For Each d In CommonDates
                Console.WriteLine(Format(d, "MM/dd/yy"))
            Next
        Catch ex As Exception
            Stop
        End Try

   End Sub


End Class

   
    
    
  








Related examples in the same category

1.Add vbCrLf to the selected value
2.Renaming property in Select
3.Using Select to return a sequence of project names
4.Query Reuse with deferred execution
5.Using Concat to create one sequence that contains each array's values
6.Using an indexed SelectMany clause
7.Using Concat to create one sequence
8.Using linq to query the Registry
9.Shows all keys under HKLM\Software that start with the letter C
10.Shows shortcuts to everything under My Recent Documents
11.Counts how many items are in your Favorites folder
12.Uses reflection to show all System assemblies which are currently loaded
13.Projecting Select
14.Using Select to produce a sequence of Integers one value higher
15.Transformation Select
16.Using Select to produce a sequence of strings from a sequence of Integers
17.Anonymous Types in Select Clause
18.Using Select to produce a sequence of each word in an array with new case.
19.Using 'Select New With' to create new objects
20.Using Select to produce a sequence of new objects from two arrays with calculation
21.Using an indexed Select clause to determine if the value of Integers match their position
22.Combine Select and Where to get value from an array based on the value from another array
23.Check for the second letter from each word in an array
24.Use a loop to print out each value in Linq query result
25.num is called the range variable which will take turns representing each value in the array.
26.Select with Function