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


C# XmlDictionaryReader.ReadContentAsFloat方法代码示例

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


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

示例1: WriteTextNode

 protected override void WriteTextNode(XmlDictionaryReader reader, bool attribute)
 {
     Type type = reader.ValueType;
     if (type == typeof(string))
     {
         XmlDictionaryString value;
         if (reader.TryGetValueAsDictionaryString(out value))
         {
             WriteString(value);
         }
         else
         {
             if (reader.CanReadValueChunk)
             {
                 if (_chars == null)
                 {
                     _chars = new char[256];
                 }
                 int count;
                 while ((count = reader.ReadValueChunk(_chars, 0, _chars.Length)) > 0)
                 {
                     this.WriteChars(_chars, 0, count);
                 }
             }
             else
             {
                 WriteString(reader.Value);
             }
         }
         if (!attribute)
         {
             reader.Read();
         }
     }
     else if (type == typeof(byte[]))
     {
         if (reader.CanReadBinaryContent)
         {
             // Its best to read in buffers that are a multiple of 3 so we don't break base64 boundaries when converting text
             if (_bytes == null)
             {
                 _bytes = new byte[384];
             }
             int count;
             while ((count = reader.ReadValueAsBase64(_bytes, 0, _bytes.Length)) > 0)
             {
                 this.WriteBase64(_bytes, 0, count);
             }
         }
         else
         {
             WriteString(reader.Value);
         }
         if (!attribute)
         {
             reader.Read();
         }
     }
     else if (type == typeof(int))
         WriteValue(reader.ReadContentAsInt());
     else if (type == typeof(long))
         WriteValue(reader.ReadContentAsLong());
     else if (type == typeof(bool))
         WriteValue(reader.ReadContentAsBoolean());
     else if (type == typeof(double))
         WriteValue(reader.ReadContentAsDouble());
     else if (type == typeof(DateTime))
         WriteValue(reader.ReadContentAsDateTimeOffset().DateTime);
     else if (type == typeof(float))
         WriteValue(reader.ReadContentAsFloat());
     else if (type == typeof(decimal))
         WriteValue(reader.ReadContentAsDecimal());
     else if (type == typeof(UniqueId))
         WriteValue(reader.ReadContentAsUniqueId());
     else if (type == typeof(Guid))
         WriteValue(reader.ReadContentAsGuid());
     else if (type == typeof(TimeSpan))
         WriteValue(reader.ReadContentAsTimeSpan());
     else
         WriteValue(reader.ReadContentAsObject());
 }
开发者ID:chcosta,项目名称:corefx,代码行数:81,代码来源:XmlBinaryWriter.cs

示例2: WriteTextNode

 protected override void WriteTextNode(XmlDictionaryReader reader, bool attribute)
 {
     Type valueType = reader.ValueType;
     if (valueType == typeof(string))
     {
         XmlDictionaryString str;
         if (reader.TryGetValueAsDictionaryString(out str))
         {
             this.WriteString(str);
         }
         else if (reader.CanReadValueChunk)
         {
             int num;
             if (this.chars == null)
             {
                 this.chars = new char[0x100];
             }
             while ((num = reader.ReadValueChunk(this.chars, 0, this.chars.Length)) > 0)
             {
                 this.WriteChars(this.chars, 0, num);
             }
         }
         else
         {
             this.WriteString(reader.Value);
         }
         if (!attribute)
         {
             reader.Read();
         }
     }
     else if (valueType == typeof(byte[]))
     {
         if (reader.CanReadBinaryContent)
         {
             int num2;
             if (this.bytes == null)
             {
                 this.bytes = new byte[0x180];
             }
             while ((num2 = reader.ReadValueAsBase64(this.bytes, 0, this.bytes.Length)) > 0)
             {
                 this.WriteBase64(this.bytes, 0, num2);
             }
         }
         else
         {
             this.WriteString(reader.Value);
         }
         if (!attribute)
         {
             reader.Read();
         }
     }
     else if (valueType == typeof(int))
     {
         this.WriteValue(reader.ReadContentAsInt());
     }
     else if (valueType == typeof(long))
     {
         this.WriteValue(reader.ReadContentAsLong());
     }
     else if (valueType == typeof(bool))
     {
         this.WriteValue(reader.ReadContentAsBoolean());
     }
     else if (valueType == typeof(double))
     {
         this.WriteValue(reader.ReadContentAsDouble());
     }
     else if (valueType == typeof(DateTime))
     {
         this.WriteValue(reader.ReadContentAsDateTime());
     }
     else if (valueType == typeof(float))
     {
         this.WriteValue(reader.ReadContentAsFloat());
     }
     else if (valueType == typeof(decimal))
     {
         this.WriteValue(reader.ReadContentAsDecimal());
     }
     else if (valueType == typeof(UniqueId))
     {
         this.WriteValue(reader.ReadContentAsUniqueId());
     }
     else if (valueType == typeof(Guid))
     {
         this.WriteValue(reader.ReadContentAsGuid());
     }
     else if (valueType == typeof(TimeSpan))
     {
         this.WriteValue(reader.ReadContentAsTimeSpan());
     }
     else
     {
         this.WriteValue(reader.ReadContentAsObject());
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:99,代码来源:XmlBinaryWriter.cs


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