diff --git a/SecureCoding/SecureSerialization/Json/Newtonsoft/SecureNewtonsoftDeserialization.cs b/SecureCoding/SecureSerialization/Json/Newtonsoft/SecureNewtonsoftDeserialization.cs
index 895bb20..1b173ef 100644
--- a/SecureCoding/SecureSerialization/Json/Newtonsoft/SecureNewtonsoftDeserialization.cs
+++ b/SecureCoding/SecureSerialization/Json/Newtonsoft/SecureNewtonsoftDeserialization.cs
@@ -23,9 +23,9 @@ public static class SecureNewtonsoftDeserialization
/// Thrown if the cannot be deserialized.
public static T DeserializeObject(string json)
{
- if (string.IsNullOrWhiteSpace(json))
+ if (json is null)
{
- throw new ArgumentException($"'{nameof(json)}' cannot be null or whitespace.", nameof(json));
+ throw new ArgumentException($"'{nameof(json)}' cannot be null.", nameof(json));
}
JsonSerializerSettings settings = new JsonSerializerSettings
@@ -51,9 +51,9 @@ public static T DeserializeObject(string json)
/// Thrown if the cannot be deserialized.
public static T DeserializeObject(string json, JsonSerializerSettings settings)
{
- if (string.IsNullOrWhiteSpace(json))
+ if (json is null)
{
- throw new ArgumentException($"'{nameof(json)}' cannot be null or whitespace.", nameof(json));
+ throw new ArgumentException($"'{nameof(json)}' cannot be null.", nameof(json));
}
if (settings is null)
@@ -63,7 +63,7 @@ public static T DeserializeObject(string json, JsonSerializerSettings setting
if (settings.TypeNameHandling != TypeNameHandling.None)
{
- throw new InsecureSerializationSettingsException($"Setting the Typenamehandling to {settings.TypeNameHandling} may result in insecure deserialization.");
+ throw new InsecureSerializationSettingsException($"Setting the TypeNameHandling to {settings.TypeNameHandling} may result in insecure deserialization.");
}
settings.SerializationBinder = null;
@@ -89,9 +89,9 @@ public static T DeserializeObject(string json, JsonSerializerSettings setting
/// Thrown if the cannot be deserialized.
public static T DeserializeObject(string json, IEnumerable knownTypes)
{
- if (string.IsNullOrWhiteSpace(json))
+ if (json is null)
{
- throw new ArgumentException($"'{nameof(json)}' cannot be null or whitespace.", nameof(json));
+ throw new ArgumentException($"'{nameof(json)}' cannot be null.", nameof(json));
}
if (knownTypes is null || !knownTypes.Any())
@@ -127,9 +127,9 @@ public static T DeserializeObject(string json, IEnumerable knownTypes)
/// Thrown if the cannot be deserialized.
public static T DeserializeObject(string json, IEnumerable knownTypes, JsonSerializerSettings settings)
{
- if (string.IsNullOrWhiteSpace(json))
+ if (json is null)
{
- throw new ArgumentException($"'{nameof(json)}' cannot be null or whitespace.", nameof(json));
+ throw new ArgumentException($"'{nameof(json)}' cannot be null.", nameof(json));
}
if (knownTypes is null || !knownTypes.Any())
@@ -148,4 +148,4 @@ public static T DeserializeObject(string json, IEnumerable knownTypes,
return JsonConvert.DeserializeObject(json, settings);
}
}
-}
+}
\ No newline at end of file