using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Newtonsoft.Json.Converters { /// /// Provides a base class for converting a to and from JSON. /// public abstract class DateTimeConverterBase : JsonConverter { /// /// Determines whether this instance can convert the specified object type. /// /// Type of the object. /// /// true if this instance can convert the specified object type; otherwise, false. /// public override bool CanConvert(Type objectType) { if (objectType == typeof(DateTime) || objectType == typeof(DateTime?)) return true; #if !PocketPC && !NET20 if (objectType == typeof(DateTimeOffset) || objectType == typeof(DateTimeOffset?)) return true; #endif return false; } } }