当前位置: 首页>>代码示例>>C#>>正文


C# XmlRpcSerializer.Serialize方法代码示例

本文整理汇总了C#中CookComputing.XmlRpc.XmlRpcSerializer.Serialize方法的典型用法代码示例。如果您正苦于以下问题:C# XmlRpcSerializer.Serialize方法的具体用法?C# XmlRpcSerializer.Serialize怎么用?C# XmlRpcSerializer.Serialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CookComputing.XmlRpc.XmlRpcSerializer的用法示例。


在下文中一共展示了XmlRpcSerializer.Serialize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Serialize

 public static XmlDocument Serialize(
   string testName,
   object obj, 
   Encoding encoding,
   MappingAction action)
 {
   Stream stm = new MemoryStream();
   XmlTextWriter xtw = new XmlTextWriter(stm, Encoding.UTF8);
   xtw.Formatting = Formatting.Indented;
   xtw.Indentation = 2;
   xtw.WriteStartDocument();      
   XmlRpcSerializer ser = new XmlRpcSerializer();
   ser.Serialize(xtw, obj, action); 
   xtw.Flush();
   //Console.WriteLine(testName);
   stm.Position = 0;    
   TextReader trdr = new StreamReader(stm, new UTF8Encoding(), true, 4096);
   String s = trdr.ReadLine();
   while (s != null)
   {
     //Console.WriteLine(s);
     s = trdr.ReadLine();
   }            
   stm.Position = 0;    
   XmlDocument xdoc = new XmlDocument();
   xdoc.PreserveWhitespace = true;
   xdoc.Load(stm);
   return xdoc;
 }
开发者ID:sgh1986915,项目名称:vfos-scraper-c-,代码行数:29,代码来源:utils.cs

示例2: Serialize

 public static XmlReader Serialize(
   string testName,
   object obj, 
   Encoding encoding,
   MappingActions actions)
 {
   Stream stm = new MemoryStream();
   XmlWriter xtw = XmlRpcXmlWriter.Create(stm, new XmlRpcFormatSettings());
   xtw.WriteStartDocument();      
   XmlRpcSerializer ser = new XmlRpcSerializer();
   ser.Serialize(xtw, obj, actions); 
   xtw.Flush();
   stm.Position = 0;    
   XmlReader rdr = XmlRpcXmlReader.Create(stm);
   return rdr;
 }
开发者ID:wbrussell,项目名称:xmlrpcnet,代码行数:16,代码来源:utils.cs

示例3: SerializeToString

 public static string SerializeToString(
   string testName,
   object obj, 
   MappingAction action)
 {
   StringWriter strwrtr = new StringWriter();
   XmlTextWriter xtw = new XmlTextWriter(strwrtr);
   //      xtw.Formatting = formatting;
   //      xtw.Indentation = indentation;
   xtw.WriteStartDocument();      
   XmlRpcSerializer ser = new XmlRpcSerializer();
   ser.Serialize(xtw, obj, action); 
   xtw.Flush();
   //Console.WriteLine(testName);
   //Console.WriteLine(strwrtr.ToString());
   return strwrtr.ToString();
 }
开发者ID:sgh1986915,项目名称:vfos-scraper-c-,代码行数:17,代码来源:utils.cs

示例4: SerializeValue

        public static string SerializeValue(object value, bool indent)
        {
            var memStm = new MemoryStream();
            var writer = XmlRpcXmlWriter.Create(
                memStm,
                new XmlRpcFormatSettings { OmitXmlDeclaration = true, UseIndentation = indent });
            var serializer = new XmlRpcSerializer();
            serializer.Serialize(writer, value, new MappingActions { NullMappingAction = NullMappingAction.Error });
            writer.Flush();
            memStm.Position = 0;

            return new StreamReader(memStm).ReadToEnd();
        }
开发者ID:magicmonty,项目名称:xmlrpcnet,代码行数:13,代码来源:Utils.cs


注:本文中的CookComputing.XmlRpc.XmlRpcSerializer.Serialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。