Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

XMLWriter write xml C#

using System;
using System.IO;
using System.Xml;

public class Sample
{
  public static void Main()
  {
     XmlTextWriter writer = new XmlTextWriter("Shopping_list.xml", null);

     //Write the root element
     writer.WriteStartElement("The_list");

     //Write sub-elements
     writer.WriteElementString("Fruit", "Banana");
     writer.WriteElementString("Vegetable", "Carrot");
     writer.WriteElementString("Drink", "Water");

     // end the root element
     writer.WriteEndElement();

     //Write the XML to file and close the writer
     writer.Close();
  }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: Commenting on C# 
Csharp :: create new object c# 
Csharp :: using in c# 
Csharp :: c# linq list select 
Csharp :: unity master volume changer 
Csharp :: C# int array initial values 
Csharp :: c# get all letters 
Csharp :: longest substring without repeating characters leetcode 
Csharp :: concat arrays .net 
Csharp :: c# unit test for throwing exception method 
Csharp :: c sharp 
Csharp :: how to use double in c# 
Csharp :: unity dotween sequence 
Csharp :: unity audio source 
Csharp :: get key in dictionary c# 
Csharp :: c# null conditional 
Csharp :: foreach c# linq example 
Csharp :: linq map array 
Csharp :: photon2 addcalbacktarget 
Csharp :: update browserslist 
Csharp :: How to make enemy shooting 
Csharp :: How to print text to screen in c# 
Csharp :: global variables unity 
Csharp :: get gameobject active state 
Csharp :: Create a button in unity to show ad 
Csharp :: c# code to check anagram 
Csharp :: Get location in Xamarin - NAYCode.com 
Csharp :: rgb to console color 
Csharp :: select a whole row out of a 2d array C# 
Csharp :: c# property attribute 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =