TryGetValueAsDictionaryString() public method

public TryGetValueAsDictionaryString ( System &value ) : bool
value System
return bool
コード例 #1
0
        protected virtual void WriteTextNode(XmlDictionaryReader reader, bool isAttribute)
        {
            XmlDictionaryString?value;

            if (reader.TryGetValueAsDictionaryString(out value))
            {
                WriteString(value);
            }
            else
            {
                WriteString(reader.Value);
            }
            if (!isAttribute)
            {
                reader.Read();
            }
        }
コード例 #2
0
        protected virtual void WriteTextNode(XmlDictionaryReader reader, bool isAttribute)
        {
            XmlDictionaryString str;

            if (reader.TryGetValueAsDictionaryString(out str))
            {
                this.WriteString(str);
            }
            else
            {
                this.WriteString(reader.Value);
            }
            if (!isAttribute)
            {
                reader.Read();
            }
        }
 protected virtual void WriteTextNode(XmlDictionaryReader reader, bool isAttribute)
 {
     XmlDictionaryString str;
     if (reader.TryGetValueAsDictionaryString(out str))
     {
         this.WriteString(str);
     }
     else
     {
         this.WriteString(reader.Value);
     }
     if (!isAttribute)
     {
         reader.Read();
     }
 }
コード例 #4
0
 protected virtual void WriteTextNode(XmlDictionaryReader reader, bool isAttribute)
 {
     XmlDictionaryString value;
     if (reader.TryGetValueAsDictionaryString(out value))
     {
         WriteString(value);
     }
     else
     {
         WriteString(reader.Value);
     }
     if (!isAttribute)
     {
         reader.Read();
     }
 }
コード例 #5
0
        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());
            }
        }
コード例 #6
0
ファイル: XmlBinaryWriter.cs プロジェクト: chcosta/corefx
 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());
 }
 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());
     }
 }