c# - Appending filename of savedialog to the file wich is going to be saved -


i trying append name of file in first line of text file going saved. how can it? here code. couldnt find method stringbuilder append @ beggining of instance.

stringbuilder sb = new stringbuilder();  sb.appendline("blah blah");  if (savefile.showdialog() == dialogresult.ok) {    //how append file name @ beggining of file saved?      file.writealltext(savefile.filename, sb.tostring()); } 

thanks.

add line before call writealltext:

sb.insert(0, savefile.filename + environment.newline); 

-- or --

string outstring = savefile.filename + environment.newline + sb.tostring();   file.writealltext(savefile.filename, outstring); 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -