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


C# XmlReaderDelegator.GetAttribute方法代码示例

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


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

示例1: ReadJsonValueCore

        public override object ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
        {
            object obj2;
            string attribute = jsonReader.GetAttribute("type");
            string key = attribute;
            if (key != null)
            {
                int num;
                if (<PrivateImplementationDetails>{D290E7C2-4296-4D66-A436-0C17851A078B}.$$method0x60012be-1.TryGetValue(key, out num))
                {
                    switch (num)
                    {
                        case 0:
                            jsonReader.Skip();
                            obj2 = null;
                            goto Label_011B;

                        case 1:
                            obj2 = jsonReader.ReadElementContentAsBoolean();
                            goto Label_011B;

                        case 2:
                            goto Label_00BB;

                        case 3:
                            obj2 = ParseJsonNumber(jsonReader.ReadElementContentAsString());
                            goto Label_011B;

                        case 4:
                            jsonReader.Skip();
                            obj2 = new object();
                            goto Label_011B;

                        case 5:
                            return DataContractJsonSerializer.ReadJsonValue(DataContract.GetDataContract(Globals.TypeOfObjectArray), jsonReader, context);
                    }
                }
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(System.Runtime.Serialization.SR.GetString("JsonUnexpectedAttributeValue", new object[] { attribute })));
            }
        Label_00BB:
            obj2 = jsonReader.ReadElementContentAsString();
        Label_011B:
            if (context != null)
            {
                context.AddNewObject(obj2);
            }
            return obj2;
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:48,代码来源:JsonObjectDataContract.cs

示例2: ReadJsonValueCore

        public override object ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
        {
            object obj;
            string contentMode = jsonReader.GetAttribute(JsonGlobals.typeString);

            switch (contentMode)
            {
                case JsonGlobals.nullString:
                    jsonReader.Skip();
                    obj = null;
                    break;
                case JsonGlobals.booleanString:
                    obj = jsonReader.ReadElementContentAsBoolean();
                    break;
                case JsonGlobals.stringString:
                case null:
                    obj = jsonReader.ReadElementContentAsString();
                    break;
                case JsonGlobals.numberString:
                    obj = ParseJsonNumber(jsonReader.ReadElementContentAsString());
                    break;
                case JsonGlobals.objectString:
                    jsonReader.Skip();
                    obj = new object();
                    break;
                case JsonGlobals.arrayString:
                    // Read as object array
                    return DataContractJsonSerializer.ReadJsonValue(DataContract.GetDataContract(Globals.TypeOfObjectArray), jsonReader, context);
                default:
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                        XmlObjectSerializer.CreateSerializationException(SR.GetString(SR.JsonUnexpectedAttributeValue, contentMode)));
            }

            if (context != null)
            {
                context.AddNewObject(obj);
            }
            return obj;
        }
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:39,代码来源:JsonObjectDataContract.cs

示例3: StartReadExtensionDataValue

 protected override void StartReadExtensionDataValue(XmlReaderDelegator xmlReader)
 {
     _extensionDataValueType = xmlReader.GetAttribute(JsonGlobals.typeString);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:4,代码来源:XmlObjectSerializerReadContextComplexJson.cs


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