當前位置: 首頁>>代碼示例>>C#>>正文


C# JsonReader.ReadAsDateTimeOffset方法代碼示例

本文整理匯總了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;
 }
開發者ID:BitTacklr,項目名稱:CloudQueueBus,代碼行數:27,代碼來源:CloudQueueMessageEnvelopeJsonReader.cs


注:本文中的Newtonsoft.Json.JsonReader.ReadAsDateTimeOffset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。