What i’m trying to do is open a config file. For each object this config file references it uses the tags BEGINOB ENDOB. I’m trying to read the while thing and Split on ENDOB, and IF the first set contains BEGINOB+”\r\n”+”13″ write all the contents to a console line. I have this code here but i’m having a hard time figure out my split.
using (FileStream redfs = new FileStream(redfoldertarget, FileMode.Open))
using (StreamReader rdrred = new StreamReader(redfs))
{
while (!rdrred.EndOfStream)
{
string linesplitnew = "ENDOB";
string[] redsplitline = rdrred.ReadToEnd().Split(Convert.ToString(linesplitnew));
string redpullline = "BEGINOB"+"\r\n"+"13";
if(redsplitline.Contains(redpullline))
{
Console.WriteLine(redsplitline);
}
}
}
You need to call the
Splitoverload that takes an array of strings, like this: