Problem while configuring the file Delimeter("\t") in app.config(C#3.0)
Posted
by Newbie
on Stack Overflow
See other posts from Stack Overflow
or by Newbie
Published on 2010-06-11T02:42:26Z
Indexed on
2010/06/11
2:52 UTC
Read the original article
Hit count: 274
c#3.0
In my app.config file I made the setting like the following
<add key = "Delimeter" value ="\t"/>
Now while accessing the above from the program by using the below code
string delimeter = ConfigurationManager.AppSettings["FileDelimeter"].ToString();
StreamWriter streamWriter = null;
streamWriter = new StreamWriter(fs);
streamWriter.BaseStream.Seek(0, SeekOrigin.End);
Enumerable
.Range(0, outData.Length)
.ToList().ForEach(i => streamWriter.Write(outData[i].ToString() + delimiter));
streamWriter.WriteLine();
streamWriter.Flush();
I am getting the output as
18804\t20100326\t5.59975381254617\t
18804\t20100326\t1.82599797249479\t
But if I directly use "\t"
in the delimeter variable I am getting the correct output
18804 20100326 5.59975381254617
18804 20100326 1.82599797249479
I found that while I am specifying the "\t" in the config file, and while reading it into
the delimeter variable, it is becoming "\\t"
which is the problem.
I even tried with but with no luck.
I am using C#3.0.
Need help
© Stack Overflow or respective owner