class Program public static bool findInText int SearchValue string fil

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
class Program
{
public static bool findInText(int SearchValue, string filePath)
{
using (StreamReader r = new StreamReader(filePath))
{
string line;
while ((line = r.ReadLine()) != null)
{
int x = Int32.Parse(line);
if (x == SearchValue) return true;
}
return false;
}
}
static void Main(string[] args)
{
string File = "C:\\test.txt";
Console.WriteLine(findInText(18, File));
}
}