-Sealed non-generic methods on JsonConverter<T>
This commit is contained in:
@@ -95,7 +95,7 @@ namespace Newtonsoft.Json
|
|||||||
/// <param name="writer">The <see cref="JsonWriter"/> to write to.</param>
|
/// <param name="writer">The <see cref="JsonWriter"/> to write to.</param>
|
||||||
/// <param name="value">The value.</param>
|
/// <param name="value">The value.</param>
|
||||||
/// <param name="serializer">The calling serializer.</param>
|
/// <param name="serializer">The calling serializer.</param>
|
||||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
public sealed override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||||
{
|
{
|
||||||
if (!(value != null ? value is T : ReflectionUtils.IsNullable(typeof(T))))
|
if (!(value != null ? value is T : ReflectionUtils.IsNullable(typeof(T))))
|
||||||
{
|
{
|
||||||
@@ -120,7 +120,7 @@ namespace Newtonsoft.Json
|
|||||||
/// <param name="existingValue">The existing value of object being read.</param>
|
/// <param name="existingValue">The existing value of object being read.</param>
|
||||||
/// <param name="serializer">The calling serializer.</param>
|
/// <param name="serializer">The calling serializer.</param>
|
||||||
/// <returns>The object value.</returns>
|
/// <returns>The object value.</returns>
|
||||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
public sealed override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||||
{
|
{
|
||||||
bool existingIsNull = existingValue == null;
|
bool existingIsNull = existingValue == null;
|
||||||
if (!(existingIsNull || existingValue is T))
|
if (!(existingIsNull || existingValue is T))
|
||||||
@@ -148,7 +148,7 @@ namespace Newtonsoft.Json
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// <c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>.
|
/// <c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public override bool CanConvert(Type objectType)
|
public sealed override bool CanConvert(Type objectType)
|
||||||
{
|
{
|
||||||
return typeof(T).IsAssignableFrom(objectType);
|
return typeof(T).IsAssignableFrom(objectType);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user