forked from 47-studio-org/PostSharp.Samples
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProgram.cs
36 lines (30 loc) · 823 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
32
33
34
35
36
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Xml;
namespace PostSharp.Samples.AutoDataContract
{
internal class Program
{
private static void Main(string[] args)
{
var testClass = new TestDerivedClass
{
SerializedProperty1 = 1,
SerializedProperty2 = "2",
NonSerializedProperty3 = 3,
SerializedProperty4 = 4,
SerializedProperty5 = "5",
NonSerializedProperty6 = 6
};
var serializer = new DataContractSerializer(typeof(TestDerivedClass));
var stringWriter = new StringWriter();
var xmlWriter = new XmlTextWriter(stringWriter)
{
Formatting = Formatting.Indented
};
serializer.WriteObject(xmlWriter, testClass);
Console.WriteLine(stringWriter);
}
}
}