Reading last symbol from text file using C# -
this question has answer here:
what efficient way read last symbol or line of large text file using c#?
if file not too large, read lines , pick last:
string lastline = file.readlines("pathtofile").lastordefault(); // if file empty
so last character in way:
char lastchar = '\0'; if(lastline != null) lastchar = lastline.lastordefault();
file.readlines
not need read lines before can start processsing, it's cheap in terms of memory consumption.
here more complicated way j. skeet: how read text file reversely iterator in c#
Comments
Post a Comment