Escribir un archivo en c#

/// <summary> /// escribir texto en un archivo /// </summary> /// <param name="cadena">Texto a escribir</param> /// <param name="Ruta">donde guardar el archivo</param> public void EscribirTxt(string cadena, string Ruta,string titulo) { StringBuilder sb = new StringBuilder(); sb.AppendLine(titulo); sb.AppendLine("= = = = = ="); sb.Append(cadena); sb.AppendLine(); sb.AppendLine(); using (StreamWriter outfile = new StreamWriter(Ruta, true)) { outfile.WriteAsync(sb.ToString()); } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.