Menu
  • HOME
  • TAGS

I'm trying to write text to a .txt file but it doesn't work [closed]

c#,asp.net,streamwriter,textwriter

I just had to run visual studio as administrator, dont waste time trying to add more answers\comments, this problem is solved

Force no BOM when saving XML

c#,xml,byte-order-mark,textwriter

You can create a UTF8Encoding instance which doesn't use the BOM, instead of using Encoding.UTF8. using (TextWriter sw = new StreamWriter(file, false, new UTF8Encoding(false))) { doc.Save(sw); } You can save this in a static field if you're worried about the cost of instantiating it repeatedly: private static readonly Encoding UTF8NoByteOrderMark...