Language Integrated Query, .NET 언어에서 데이터 집합을 쿼리하는 기능을 제공하는 통합된 쿼리 기술이고, C# 및 Visual Basic과 같은 언어에서 활용되고 있음
SQL문과 유사해서 사용이 어려울 것 같지는 않음! 단, 복잡한 쿼리는 불가능!!
SQL문에서는 SELECT가 먼저 나오지만, LINQ문에서는 SELECT가 제일 마지막에 등장
Dim query = From student In students
Where student.Age > 20
Order By student.LastName
Select student.FirstName, student.LastName
LINQ의 메서드를 사용하여 데이터를 쿼리하고 조작하는 방법
일반적으로 확장 메서드 형식으로 사용되며, 메서드 체이닝을 통해 쿼리를 작성
Dim query = students.Where(Function(student) student.Age > 20)
.OrderBy(Function(student) student.LastName)
.Select(Function(student) New With { .FirstName = student.FirstName, .LastName = student.LastName })
sample = {"a", "b", "c", "d", "e"}
dictSample = sample.Select(Function(s, i) New With { Key .Key = s, Key .Value = i }).ToDictionary(Function(x) x.Key, Function(x) x.Value)
sample_key = {"A", "B", "C"}
sample_value = {"1", "2", "3"}
dictKV = sample_key.Zip(sample_value, Function(k, v) New With { Key .Key = k, Key .Value = v }).ToDictionary(Function(x) x.Key, Function(x) x.Value)
sample.ToList / sample.ToArray 변수 뒤에 메서드 사용하여 다른 유형으로 변경 가능