C
CCLeasing
Hi i'm trying to check if the last line in a file is equal to a string
i'm comparing it with.
I have the general idea of what I should be doing. Could someone take a
look at the following and comment it or suggest improvements. As code
it doesn't work at the moment but I hope from it you can see what i'm
trying to do.
private bool checkduplicates(string filepath, string linetocheck)
{
string[] lines = File.ReadAllLines(@filepath);
if lines[last element?].ToString() = linetocheck then
return true;
else return false;
}
basically i want to be able to provide two arguments to checkduplicates
function.
filepath and linetocheck.
i want to open the file at filepath, read it into an array line by
line. and then compare the last line of the file with the string
linetocheck. I want to return true if the line matches, and false if it
doesn't.
Thanks.
i'm comparing it with.
I have the general idea of what I should be doing. Could someone take a
look at the following and comment it or suggest improvements. As code
it doesn't work at the moment but I hope from it you can see what i'm
trying to do.
private bool checkduplicates(string filepath, string linetocheck)
{
string[] lines = File.ReadAllLines(@filepath);
if lines[last element?].ToString() = linetocheck then
return true;
else return false;
}
basically i want to be able to provide two arguments to checkduplicates
function.
filepath and linetocheck.
i want to open the file at filepath, read it into an array line by
line. and then compare the last line of the file with the string
linetocheck. I want to return true if the line matches, and false if it
doesn't.
Thanks.