28
1
using System;
2
using System.Linq;
3
using System.Collections.Generic;
4
5
public class Program
6
{
7
public static void Main()
8
{
9
// string collection
10
IList<string> stringList = new List<string>() {
11
"C# Tutorials",
12
"VB.NET Tutorials",
13
"Learn C++",
14
"MVC Tutorials" ,
15
"Java"
16
};
17
18
// LINQ Query Syntax
19
var result = from s in stringList
20
where s.Contains("Tutorials")
21
select s;
22
23
foreach (var str in result)
24
{
25
Console.WriteLine(str);
26
}
27
}
28
}
Cached Result
Compilation error (line 1, col 1): A namespace cannot directly contain members such as fields or methods