本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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;
}