-
Notifications
You must be signed in to change notification settings - Fork 8
/
Program.cs
31 lines (27 loc) · 873 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System.Text;
using System.Xml;
using (var fw = new StreamWriter(@"c:\temp\out.txt"))
{
fw.WriteLine($"Writing to a file at {DateTime.Now}");
}
string xmlContent =
"<message><text>Hello</text><recipient>world</recipient></message>";
var xmlReader = XmlReader.Create(new StringReader(xmlContent));
while (xmlReader.Read())
{
if (xmlReader.NodeType == XmlNodeType.Text)
{
Console.WriteLine(xmlReader.Value);
}
}
using (var sw = new StreamWriter("Text.txt", false,
Encoding.GetEncoding(1252)))
{
sw.Write("£100");
}
// Members of StreamReader for illustration purposes only. These are defined by .NET so
// we don't need to define them ourselves.
#if false
public virtual int Read(char[] buffer, int index, int count) { ... }
public virtual int ReadBlock(char[] buffer, int index, int count) { ... }
#endif