DateTimeConverterBase
Provides a base class for converting a DateTime to and from JSON.
using System;
using System.Runtime.CompilerServices;
namespace Newtonsoft.Json.Converters
{
public abstract class DateTimeConverterBase : JsonConverter
{
[System.Runtime.CompilerServices.NullableContext(1)]
public override bool CanConvert(Type objectType)
{
if ((object)objectType == typeof(DateTime) || (object)objectType == typeof(DateTime?))
return true;
if ((object)objectType == typeof(DateTimeOffset) || (object)objectType == typeof(DateTimeOffset?))
return true;
return false;
}
}
}