C
CCLeasing
I have a function that generates an error if the file it is operating
on is empty. I would like to add some error protection in. The
modification i tried to make to the function i've included in the
commented section in the code. However the ide underlines the
lines.Length in red indicating that it isn't accesible why is this? how
else can i code this?
private bool CheckDuplicates(string filepath, string linetocheck)
{
string[] lines = File.ReadAllLines(filepath);
/// i would like to do something like....
/// if lines.Length < 0 Then Messagebox("file is empty");
/// else
if (lines[lines.Length - 1] == linetocheck)
return true;
else
return false;
}
on is empty. I would like to add some error protection in. The
modification i tried to make to the function i've included in the
commented section in the code. However the ide underlines the
lines.Length in red indicating that it isn't accesible why is this? how
else can i code this?
private bool CheckDuplicates(string filepath, string linetocheck)
{
string[] lines = File.ReadAllLines(filepath);
/// i would like to do something like....
/// if lines.Length < 0 Then Messagebox("file is empty");
/// else
if (lines[lines.Length - 1] == linetocheck)
return true;
else
return false;
}