本文整理匯總了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;
}