If you have very looked at the sample for DocumentDB, under the Shared project and in the Until folder, you will see the following class.

go to site namespace DocumentDB.Samples.Shared.Util { using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Resources; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using Newtonsoft.Json.Converters; public class UnixDateTimeConverter : DateTimeConverterBase { private static readonly DateTime UnixStartTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { if (value is DateTime) { long totalSeconds = (long)((DateTime)value - UnixStartTime).TotalSeconds; writer.WriteValue(totalSeconds); } else { throw new ArgumentException("value"); } } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (reader.TokenType != Newtonsoft.Json.JsonToken.Integer) { throw new Exception("Invalid token. Expected integer"); } double totalSeconds = 0; try { totalSeconds = Convert.ToDouble(reader.Value, CultureInfo.InvariantCulture); } catch { throw new Exception("Invalid double value."); } return UnixStartTime.AddSeconds(totalSeconds); } } }

alli orlistat where can i buy Lyrica tablets The primary use of this class is to be used as a converter type for the JsonConverter Attribute as shown in the following code sample.

[JsonProperty("created_at")] [JsonConverter(typeof(UnixDateTimeConverter))] public DateTime CreatedAt { get; set; }

The [JsonConverter(Type)] attribute instructs the JsonSerializer to use the  convert  an object to and from JSON

Besides DocumentDB, many social services use a double data type for DateTime values.  Twitter for one, is a good example.  By decorating your models class properties with this attribute,  your DateTime value will be serialized as a UnixDateTime value in JSON format when writing and from JSON  when reading.