comparison Implab/Formats/JSON/JSONXmlReader.cs @ 225:8222a2ab3ab7 v2

JSONXmlReaderFixed fixed boolean values handling
author cin
date Wed, 23 Aug 2017 02:38:02 +0300
parents c32688129f14
children
comparison
equal deleted inserted replaced
224:1ba2127cfcd8 225:8222a2ab3ab7
264 264
265 public override string Value { 265 public override string Value {
266 get { 266 get {
267 if (m_parser.ElementValue == null) 267 if (m_parser.ElementValue == null)
268 return String.Empty; 268 return String.Empty;
269 if (Convert.GetTypeCode(m_parser.ElementValue) == TypeCode.Double) 269
270 return ((double)m_parser.ElementValue).ToString(CultureInfo.InvariantCulture); 270 switch(Convert.GetTypeCode (m_parser.ElementValue)) {
271 return m_parser.ElementValue.ToString(); 271 case TypeCode.Double:
272 return ((double)m_parser.ElementValue).ToString (CultureInfo.InvariantCulture);
273 case TypeCode.String:
274 return (string)m_parser.ElementValue;
275 case TypeCode.Boolean:
276 return (bool)m_parser.ElementValue ? "true" : "false";
277 default:
278 return m_parser.ElementValue.ToString ();
279 }
272 } 280 }
273 } 281 }
274 282
275 void SetLocalName(string name) { 283 void SetLocalName(string name) {
276 m_localNameStack.Push(m_localName); 284 m_localNameStack.Push(m_localName);