コード例 #1
0
ファイル: TypeViewer.cs プロジェクト: radtek/-MyCommonLibs
 public static void WiteTypeDesc(string fileName, VarDesc td)
 {
     using (FileStream stream = new FileStream(fileName, FileMode.Create))
         using (XmlWriter xmlWrier = XmlWriter.Create(stream, new XmlWriterSettings {
             Indent = true, Encoding = Encoding.UTF8
         }))
             using (XmlDictionaryWriter dictWriter = XmlDictionaryWriter.CreateDictionaryWriter(xmlWrier))
             {
                 DataContractSerializer ser = new DataContractSerializer(typeof(VarDesc));
                 ser.WriteObject(dictWriter, td);
                 dictWriter.Flush();
             }
 }
コード例 #2
0
ファイル: TypeViewer.cs プロジェクト: radtek/-MyCommonLibs
        public static void Case0()
        {
            //Type tt = typeof(XmlDictionaryWriter);
            //Type tt = typeof(int);
            //Type tt = typeof(Guid);
            //Type tt = typeof(int[]);
            //Type tt = typeof(List<Dictionary<int, string>>);
            //Type tt = typeof(myAAA);
            //Type tt = typeof(Dictionary<string, int>);
            //Type tt = typeof(myCCC);
            //Type tt = typeof(System.Security.Cryptography.X509Certificates.X509Certificate2);
            //Type tt = typeof(object);
            Type    tt = typeof(string);
            VarDesc td = TypeViewer.ParseType(tt, "root");

            Helpers.WiteTypeDesc($@"f:\111.xml", td);
        }