Please check it. Hope so it will help you.
private static string ReadAllLines(string FilePath, int LineNo)
{
try
{
string[] AllLinesOfFile = File.ReadAllLines(FilePath);
#region Get Spacific values
if (LineNo < AllLinesOfFile.Length)
{
string[] ResultantArray = null;
Array.Copy(AllLinesOfFile, LineNo, ResultantArray, 0, AllLinesOfFile.Length - 1);
return string.Join(Environment.NewLine, ResultantArray);
}
#endregion
return string.Empty;
}
catch (Exception)
{
throw;
}
}
if any issue let me know.
Thanx
Muhammad USman