Skip to content

Commit

Permalink
Invert if statement to reduce nesting
Browse files Browse the repository at this point in the history
  • Loading branch information
senioroman4uk committed Mar 5, 2024
1 parent aa48739 commit b1734a8
Showing 1 changed file with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,23 +298,25 @@ internal bool IsDeltaOfT
{
get
{
if (_isDeltaOfT == null)
if (_isDeltaOfT != null)
{
if (Type == null)
{
_isDeltaOfT = false;
}
else if (Type.IsGenericType)
{
var genericTypeDefinition = Type.GetGenericTypeDefinition();
_isDeltaOfT = (genericTypeDefinition == typeof(Delta<>) ||
genericTypeDefinition == typeof(DeltaSet<>) ||
genericTypeDefinition == typeof(DeltaDeletedResource<>));
}
else
{
_isDeltaOfT = false;
}
return _isDeltaOfT.Value;
}

if (Type == null)
{
_isDeltaOfT = false;
}
else if (Type.IsGenericType)
{
var genericTypeDefinition = Type.GetGenericTypeDefinition();
_isDeltaOfT = (genericTypeDefinition == typeof(Delta<>) ||
genericTypeDefinition == typeof(DeltaSet<>) ||
genericTypeDefinition == typeof(DeltaDeletedResource<>));
}
else
{
_isDeltaOfT = false;
}

return _isDeltaOfT.Value;
Expand Down

0 comments on commit b1734a8

Please sign in to comment.