c# - Write a character at the end of an array -


here's code:

for (int j = 0; j < bufferreader.length; j++) {     using (streamwriter sw = file.appendtext(@"c:\users\yamald\documents\normal.data"))     {         //sw.write();          if (bufferreader.length != null)         {             sw.write(bufferreader[j] + ",");         }         else         {             sw.writeline("\n");         }     } } 

how can write "\n" @ end of array file? else command not run.

you need place sw.writeline("\n"); after loop.

as loop stops when j = bufferreader.length, if statement true.

also, think bufferreader.length never null never modify variable. think need :

if (bufferreader.length > j) 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -