本文整理汇总了C#中Newtonsoft.Json.JsonReader.ReadAsDateTimeOffset方法的典型用法代码示例。如果您正苦于以下问题:C# JsonReader.ReadAsDateTimeOffset方法的具体用法?C# JsonReader.ReadAsDateTimeOffset怎么用?C# JsonReader.ReadAsDateTimeOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Newtonsoft.Json.JsonReader
的用法示例。
在下文中一共展示了JsonReader.ReadAsDateTimeOffset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
public IConfigureCloudQueueMessageEnvelope Read(JsonReader reader)
{
if (reader == null) throw new ArgumentNullException("reader");
IConfigureCloudQueueMessageEnvelope envelope = new CloudQueueMessageEnvelope();
reader.Read(); //StartObject
reader.Read(); //PropertyName:From
envelope = envelope.SetFrom(reader.ReadAsString()); //String:From value
reader.Read(); //PropertyName:To
envelope = envelope.SetTo(reader.ReadAsString()); //String:To value
reader.Read(); //PropertyName:MessageId
envelope = envelope.SetMessageId(new Guid(reader.ReadAsString())); //String:MessageId value
reader.Read();
if (((string)reader.Value) == "RelatesToMessageId") //PropertyName:Possibly RelatesToMessageId
{
envelope = envelope.SetRelatesToMessageId(new Guid(reader.ReadAsString()));
reader.Read(); //PropertyName:CorrelationId
}
envelope = envelope.SetCorrelationId(new Guid(reader.ReadAsString())); //String:CorrelationId value
reader.Read(); //PropertyName:ContentType
envelope = envelope.SetContentType(reader.ReadAsString()); //String:ContentType value
reader.Read(); //PropertyName:Content
envelope = envelope.SetContent(reader.ReadAsBytes()); //String:Content value
reader.Read(); //PropertyName:Time
envelope = envelope.SetTime(reader.ReadAsDateTimeOffset().GetValueOrDefault()); //String:Time value
reader.Read(); //EndObject
return envelope;
}