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
Post a Comment