c# - Read Specific Strings from Text File -
i'm trying strings out of text file , put in variable. structure of text file looks keep in mind 1 line , each line looks , separated blank line:
date: 8/12/2013 12:00:00 source path: \\build\pm\11.0.64.1\build.11.0.64.1.fileserveroutput.zip destination path: c:\users\documents\.net development\testing\11.0.64.1\build.11.0.55.5.fileserveroutput.zip folder updated: 11.0.64.1 file copied: build.11.0.55.5.fileserveroutput.zip
i wasn't entirely sure of use delimiter text file or if should using delimiter subjected change.
so quick example of want happen this, want go through , grab destination path , store in variable such strdestpath.
overall code came far this:
//find variables text file string[] lines = file.readalllines(globalvars.strlogpath);
yeah not much, thought perhaps if read 1 line @ at time , tried search looking through line i'm not 100% sure if should stick way or not...
if skeptical how large file is, should come using readlines
deferred execution instead of readalllines
:
var lines = file.readlines(globalvars.strlogpath);
the readlines
, readalllines
methods differ follows:
when use readlines, can start enumerating collection of strings before whole collection returned; when use readalllines, must wait whole array of strings returned before can access array. therefore, when working large files, readlines can more efficient.
Comments
Post a Comment