17
1
Option Strict On
2
Imports System
3
Imports System.Linq
4
Public Module Module1
5
Public Sub Main()
6
'Declare a collection to store names
7
Dim names() As String = {"David", "Michael", "Stephen"}
8
9
'Print the first value from the collection
10
Console.WriteLine(names.First()) 'names.First() = "David"
11
12
'Print the first or default value from the collection that matches what the user input
13
Console.Write("Name: ")
14
Dim input As String = Console.ReadLine()
15
Console.WriteLine((From name As String In names Where name = name).FirstOrDefault())
16
End Sub
17
End Module
Cached Result