This article shows how to more easily create a text file using a library in C# using both XML and C#.
This article will discuss applications of XML and C#. This article shows how to more easily create a text file using a library in C# using both XML and C#.Here we go.FunctioningThis code creates a button click event for creating the text file using a library. A direct button from the toolkit is used and the text file is created on its click event.For example:
button1_Click(object sender, RoutedEventArgs e)
Then in the event there will be a text file like in my case it is abhi.txt, that will directly get called on the click event.ProcedureFirst of all use the following procedure:
public MainPage()
{
this.InitializeComponent();
// initializing component
}
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
private async void button1_Click(object sender, RoutedEventArgs e)
//functioning of click event
StorageFolder storefolder = KnownFolders.DocumentsLibrary;
StorageFile testfile = await storefolder.CreateFileAsync("abhi.txt",CreationCollisionOption.Replac Existing);
// functioning & calling
await FileIO.WriteTextAsync(testfile, "I love C# corner");
FileInfo in C#