Coalesce nulls rather than null test where applicable. (#1150)

This commit is contained in:
Jon Hanna
2017-01-08 15:36:31 +13:00
committed by James Newton-King
parent 2061a8bb9a
commit f4c17aedb2
12 changed files with 33 additions and 34 deletions
@@ -142,7 +142,7 @@ namespace Newtonsoft.Json.Utilities
public static Type GetObjectType(object v)
{
return (v != null) ? v.GetType() : null;
return v?.GetType();
}
public static string GetTypeName(Type t, TypeNameAssemblyFormatHandling assemblyFormat, ISerializationBinder binder)
@@ -735,7 +735,7 @@ namespace Newtonsoft.Json.Utilities
{
T[] attributes = GetAttributes<T>(attributeProvider, inherit);
return (attributes != null) ? attributes.FirstOrDefault() : null;
return attributes?.FirstOrDefault();
}
#if !(DOTNET || PORTABLE)