コード例 #1
0
        public static object ReadDataSetProperty(XmlReader reader, Type type)
        {
            object result = null;

            if (!reader.IsEmptyElement)
            {
                using (FormattersHelpers.GetWhitespaceHandlingRestorer(reader, WhitespaceHandling.All))
                {
                    reader.ReadStartElement();
                    if (reader.NodeType == XmlNodeType.Text)
                    {
                        result = ((FormattersHelpers.GetValueDelegate)FormattersHelpers.typeConvertersHash[type])(reader.ReadString());
                    }
                    else
                    {
                        string text = FormattersHelpers.ReadWhiteSpace(reader);
                        if (reader.NodeType == XmlNodeType.EndElement)
                        {
                            result = text;
                        }
                        else if ((result = XmlaClient.CheckAndGetDatasetError(reader)) == null)
                        {
                            FormattersHelpers.CheckException(reader);
                            if (type == typeof(object))
                            {
                                result = FormattersHelpers.ReadPropertyXml(reader);
                            }
                        }
                    }
                    reader.ReadEndElement();
                    return(result);
                }
            }
            reader.Read();
            result = ((FormattersHelpers.GetValueDelegate)FormattersHelpers.typeConvertersHash[type])(string.Empty);
            return(result);
        }