Click here to Skip to main content
15,890,512 members
Home / Discussions / C#
   

C#

 
AnswerRe: double to string without point Pin
PIEBALDconsult16-Mar-11 15:18
mvePIEBALDconsult16-Mar-11 15:18 
GeneralRe: double to string without point Pin
Luc Pattyn16-Mar-11 16:43
sitebuilderLuc Pattyn16-Mar-11 16:43 
GeneralRe: double to string without point Pin
Pierre besquent16-Mar-11 23:25
Pierre besquent16-Mar-11 23:25 
AnswerRe: double to string without point Pin
charles henington17-Mar-11 12:28
charles henington17-Mar-11 12:28 
QuestionCustom Bindable List Population [solved] Pin
cjb11016-Mar-11 6:19
cjb11016-Mar-11 6:19 
AnswerRe: Custom Bindable List Population Pin
JP_Rocks27-Mar-11 0:25
JP_Rocks27-Mar-11 0:25 
QuestionNew line with streamwriter [Solved] Pin
Pierre besquent16-Mar-11 4:45
Pierre besquent16-Mar-11 4:45 
AnswerRe: New line with streamwriter Pin
Luc Pattyn16-Mar-11 5:17
sitebuilderLuc Pattyn16-Mar-11 5:17 
Not sure what your problem is; this:
string fn="swl.txt";
using (StreamWriter sw=new StreamWriter(fn, true, Encoding.ASCII)) {
    sw.WriteLine("line 1");
    sw.WriteLine("line 2");
    sw.WriteLine();
    sw.WriteLine();
    sw.WriteLine("line 5");
    sw.WriteLine("line 6");
    sw.WriteLine();
    sw.WriteLine();
}
string[] sa=File.ReadAllLines(fn);
foreach (string s in sa) log(s);
log("done");

works just fine for me, as it generates:
16:14:29.329    CPTest.log-59                        line 1
16:14:29.335    CPTest.log-59                        line 2
16:14:29.341    CPTest.log-59                        
16:14:29.347    CPTest.log-59                        
16:14:29.353    CPTest.log-59                        line 5
16:14:29.358    CPTest.log-59                        line 6
16:14:29.364    CPTest.log-59                        
16:14:29.369    CPTest.log-59                        
16:14:29.375    CPTest.log-59                        done


The obvious way to make things fail would be by reassigning the streamwriter's NewLine property.

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

GeneralRe: New line with streamwriter Pin
Pierre besquent16-Mar-11 6:04
Pierre besquent16-Mar-11 6:04 
AnswerRe: New line with streamwriter Pin
Luc Pattyn16-Mar-11 6:29
sitebuilderLuc Pattyn16-Mar-11 6:29 
AnswerRe: New line with streamwriter Pin
Groulien16-Mar-11 5:17
Groulien16-Mar-11 5:17 
GeneralRe: New line with streamwriter Pin
Pierre besquent16-Mar-11 6:03
Pierre besquent16-Mar-11 6:03 
AnswerRe: New line with streamwriter Pin
Paladin200016-Mar-11 6:31
Paladin200016-Mar-11 6:31 
GeneralRe: New line with streamwriter Pin
Luc Pattyn16-Mar-11 7:22
sitebuilderLuc Pattyn16-Mar-11 7:22 
GeneralRe: New line with streamwriter Pin
Paladin200016-Mar-11 8:26
Paladin200016-Mar-11 8:26 
GeneralRe: New line with streamwriter Pin
Luc Pattyn16-Mar-11 8:33
sitebuilderLuc Pattyn16-Mar-11 8:33 
GeneralRe: New line with streamwriter Pin
Paladin200016-Mar-11 8:45
Paladin200016-Mar-11 8:45 
GeneralRe: New line with streamwriter Pin
Luc Pattyn16-Mar-11 9:46
sitebuilderLuc Pattyn16-Mar-11 9:46 
GeneralRe: New line with streamwriter Pin
Pierre besquent17-Mar-11 0:24
Pierre besquent17-Mar-11 0:24 
AnswerRe: New line with streamwriter Pin
Luc Pattyn17-Mar-11 4:35
sitebuilderLuc Pattyn17-Mar-11 4:35 
GeneralRe: New line with streamwriter Pin
Pierre besquent17-Mar-11 6:00
Pierre besquent17-Mar-11 6:00 
GeneralRe: New line with streamwriter Pin
Luc Pattyn17-Mar-11 6:29
sitebuilderLuc Pattyn17-Mar-11 6:29 
AnswerRe: New line with streamwriter Pin
jschell16-Mar-11 8:27
jschell16-Mar-11 8:27 
GeneralRe: New line with streamwriter Pin
Pierre besquent17-Mar-11 0:15
Pierre besquent17-Mar-11 0:15 
GeneralRe: New line with streamwriter Pin
jschell17-Mar-11 10:03
jschell17-Mar-11 10:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.