Skip to content

Commit

Permalink
Change null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcosLopezC committed Sep 30, 2023
1 parent 2185872 commit 204be91
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions Sources/LightJson/JsonValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public bool IsDateTime
{
get
{
return this.AsDateTime != null;
return this.AsDateTime is not null;
}
}

Expand Down Expand Up @@ -437,7 +437,7 @@ public JsonValue(double? value)
/// <param name="value">The value to be wrapped.</param>
public JsonValue(string value)
{
if (value != null)
if (value is not null)
{
this.value = default(double);

Expand All @@ -457,7 +457,7 @@ public JsonValue(string value)
/// <param name="value">The value to be wrapped.</param>
public JsonValue(JsonObject value)
{
if (value != null)
if (value is not null)
{
this.value = default(double);

Expand All @@ -477,7 +477,7 @@ public JsonValue(JsonObject value)
/// <param name="value">The value to be wrapped.</param>
public JsonValue(JsonArray value)
{
if (value != null)
if (value is not null)
{
this.value = default(double);

Expand Down Expand Up @@ -546,7 +546,7 @@ public static implicit operator JsonValue(JsonArray value)
/// <param name="value">The value to be converted.</param>
public static implicit operator JsonValue(DateTime? value)
{
if (value == null)
if (value is null)
{
return JsonValue.Null;
}
Expand Down Expand Up @@ -781,7 +781,7 @@ public static JsonValue Parse(string text)
/// <param name="obj">The object to test.</param>
public override bool Equals(object obj)
{
if (obj == null)
if (obj is null)
{
return this.IsNull;
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/LightJson/Serialization/JsonReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ private JsonValue Parse()
/// <param name="reader">The TextReader used to read a JSON message.</param>
public static JsonValue Parse(TextReader reader)
{
if (reader == null)
if (reader is null)
{
throw new ArgumentNullException("reader");
}
Expand All @@ -441,7 +441,7 @@ public static JsonValue Parse(TextReader reader)
/// <param name="source">The string containing the JSON message.</param>
public static JsonValue Parse(string source)
{
if (source == null)
if (source is null)
{
throw new ArgumentNullException("source");
}
Expand All @@ -458,7 +458,7 @@ public static JsonValue Parse(string source)
/// <param name="path">The file path to be read.</param>
public static JsonValue ParseFile(string path)
{
if (path == null)
if (path is null)
{
throw new ArgumentNullException("path");
}
Expand Down

0 comments on commit 204be91

Please sign in to comment.