0
string s1 = "This is";
string s2 = "Overview";

List<string> lines = Files.ReadLines(f).ToList();
If (lines.Count>i)
lines.Insert(i, s1+ s2);

else
lines.Add(s1 + s2);
File.WriteAllLines(f, lines);

I am getting an out put of This is Overview... I need an out of This is "Overview"..

I tried putting apostrophes directly but it says error.. Any help is appreciated.

1 Answers1

0
string s1 = "This is";
string s2 = "\"Overview\"";

List<string> lines = Files.ReadLines(f).ToList();
If (lines.Count>i)
lines.Insert(i, s1+ s2);

else
lines.Add(s1 + s2);
File.WriteAllLines(f, lines);
  • Thanks man.. It works great.. And another thing.. Like.. If i want to put the whole program in loop like after executing it should return to the start of the program and run again.. – user6435267 Jun 09 '16 at 04:09
  • please explain with example – akshay.s.jagtap Jun 09 '16 at 05:11
  • like say i have a simple hello world program triggered by user input.. So that if i run the program and press enter it will show the hello world msg.. And if i want the program to be in continues loop like even after showing the hello world msg, it should return back to "press any key to see the msg" function.. The loop will go on till user press escape... – user6435267 Jun 09 '16 at 05:16
  • dude. You there bro – user6435267 Jun 09 '16 at 05:34