Write a String to a .txt File

RobinJ 276 Reputation points
2020-12-05T21:12:55.823+00:00

Hey everyone,
Can anybody tell me why my code isn't working?
I try to write a string to a .txt File.

System.IO.File.WriteAllText(confirmation);
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,997 questions
0 comments No comments
{count} votes

Accepted answer
  1. Karen Payne MVP 35,436 Reputation points
    2020-12-05T21:24:44.703+00:00

    Hello @RobinJ

    The signature for WriteAllText is, first parameter is the path and filename while the second is for the string contain information to write to parameter 1.

    public static void WriteAllText (string path, string? contents);

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.