-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathProgram.cs
More file actions
42 lines (38 loc) · 1.22 KB
/
Copy pathProgram.cs
File metadata and controls
42 lines (38 loc) · 1.22 KB
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
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.IO;
using System.Text;
using System.Xml;
namespace Text
{
class Program
{
static void Main(string[] args)
{
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
}