how to search a csv file for a perticular Word without manually opening it [closed]

You cannot scan content of a file without reading it:

string content = File.ReadAllText(path);
if (content.Contains("word"))
{
    // Text is found
}
else
{
    // Text is not found
}

You might consider using a regex:

if (Regex.IsMatch(content, @"\bword\b", RegexOptions.IgnoreCase))
{
    // Word is found
}
else
{
    // Word is not found
}

Browse More Popular Posts

Leave a Comment