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


C# JsonReader.ReadProperty方法代码示例

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


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

示例1: Read

        public override object Read(JsonReader reader)
        {
            var p = (StringProperty)base.Read(reader);
            p.Separator = reader.ReadProperty().Value.ToString();
            p.SplitType = (StringSplitType)Enum.Parse(typeof(StringSplitType),
                                reader.ReadProperty().Value.ToString());
            p.Dictionary = ((object[])reader.ReadArrayProperty().Value)
                                .Select(o => (string)o)
                                .ToArray();
            p.Exclude = ((object[])reader.ReadProperty().Value)
                                .Select(o => (string)o)
                                .ToArray();
            p.AsEnum = (bool)reader.ReadProperty().Value;

            return p;
        }
开发者ID:sethjuarez,项目名称:numl,代码行数:16,代码来源:StringPropertySerializer.cs

示例2: while

        object IJsonSerializable.Deserialize(JsonReader reader)
        {
            string property;
            while (reader.ReadProperty(out property))
            {
                switch (property)
                {
                    case "type":
                        Type = reader.ReadValue<string>();
                        break;
                    case "message":
                        Message = reader.ReadValue<string>();
                        break;
                    case "stackTrace":
                        StackTrace = reader.ReadValue<string>();
                        break;
                    case "url":
                        Url = reader.ReadValue<string>();
                        break;
                    case "refererUrl":
                        RefererUrl = reader.ReadValue<string>();
                        break;
                    case "additionalInfo":
                        AdditionalInfo = reader.ReadValue<Dictionary<string, object>>();
                        break;
                    default:
                        throw new ArgumentException("The specified property could not be deserialized.", property);
                }
            }

            return this;
        }
开发者ID:vc3,项目名称:ExoWeb,代码行数:32,代码来源:ServiceError.cs

示例3: Read

 public override object Read(JsonReader reader)
 {
     var p = (EnumerableProperty)base.Read(reader);
     var length = int.Parse(reader.ReadProperty().Value.ToString());
     p.Length = length;
     return p;
 }
开发者ID:sethjuarez,项目名称:numl,代码行数:7,代码来源:EnumerablePropertySerializer.cs

示例4: Read

        /// <summary>
        /// Reads serialized neural network model
        /// </summary>
        /// <param name="reader">JsonReader</param>
        /// <returns>Deserialized neural network model</returns>
        public override object Read(JsonReader reader)
        {
            if (reader.IsNull()) return null;
            else
            {
                var model = base.Read(reader) as NeuralNetworkModel;
                var outputFunction = reader.ReadProperty().Value;
                if (outputFunction != null)
                {
                    var type = Ject.FindType(outputFunction.ToString());
                    model.OutputFunction = (IFunction)Activator.CreateInstance(type);
                }

                model.Network = reader.ReadProperty().Value as Network;

                return model;
            }
        }
开发者ID:sethjuarez,项目名称:numl,代码行数:23,代码来源:NeuralNetworkModelSerializer.cs

示例5: Read

        /// <summary>
        /// Deserializes a generic model object from the stream.
        /// </summary>
        /// <param name="reader">A JSON Reader.</param>
        /// <returns></returns>
        public override object Read(JsonReader reader)
        {
            if (reader.IsNull()) return null;
            else
            {
                var model = (numl.Supervised.Model)Create();
                model.Descriptor = (numl.Model.Descriptor)reader.ReadProperty().Value;
                model.NormalizeFeatures = (bool)reader.ReadProperty().Value;

                var normalizer = Ject.FindType(reader.ReadProperty().Value.ToString());
                if(normalizer != null)
                    model.FeatureNormalizer = (INormalizer)Activator.CreateInstance(normalizer);

                model.FeatureProperties = (Math.Summary)reader.ReadProperty().Value;

                return model;
            }
        }
开发者ID:sethjuarez,项目名称:numl,代码行数:23,代码来源:ModelSerializer.cs

示例6: Read

 public override object Read(JsonReader reader)
 {
     if (reader.IsNull())
         return null;
     else
     {
         var t = base.Read(reader) as Tree;
         t.Root = reader.ReadProperty().Value as IVertex;
         return t;
     }
 }
开发者ID:sethjuarez,项目名称:numl,代码行数:11,代码来源:TreeSerializer.cs

示例7: while

            object IJsonSerializable.Deserialize(JsonReader reader)
            {
                // Set defaults
                InScope = true;
                ForLoad = true;

                string property;
                while (reader.ReadProperty(out property))
                {
                    switch (property)
                    {
                        case "from":
                            string typeName = reader.ReadValue<string>();
                            if (typeName != null)
                                From = ModelContext.Current.GetModelType(typeName);
                            break;
                        case "ids":
                            IsList = true;
                            Ids = reader.ReadValue<string[]>();
                            break;
                        case "id":
                            IsList = false;
                            Ids = new string[] { reader.ReadValue<string>() };
                            break;
                        case "include":
                            Include = reader.ReadValue<string[]>();
                            break;
                        case "inScope":
                            InScope = reader.ReadValue<bool>();
                            break;
                        case "forLoad":
                            ForLoad = reader.ReadValue<bool>();
                            break;
                        default:
                            throw new ArgumentException("The specified property could not be deserialized.", property);
                    }
                }

                return this;
            }
开发者ID:vc3,项目名称:ExoWeb,代码行数:40,代码来源:ServiceRequest.cs

示例8: Deserialize

            public object Deserialize(JsonReader reader)
            {
                string property;
                while (reader.ReadProperty(out property))
                {
                    switch (property)
                    {
                        case "source":
                            Source = reader.ReadValue<ChangeSource>();
                            break;
                        case "changes":
                            Changes = reader.ReadValue<List<ModelEvent>>();
                            break;
                        default:
                            throw new ArgumentException("The specified property could not be deserialized.", property);
                    }
                }

                return this;
            }
开发者ID:vc3,项目名称:ExoWeb,代码行数:20,代码来源:ServiceRequest.cs


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