Skip to content

Commit

Permalink
Update src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/Avoi…
Browse files Browse the repository at this point in the history
…dConstArrays.cs

Co-authored-by: Youssef Victor <[email protected]>
  • Loading branch information
mavasani and Youssef1313 authored Jun 19, 2023
1 parent 5595184 commit 1a70e89
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ public override void Initialize(AnalysisContext context)
}

// Must be literal array
if (arrayCreationOperation.Initializer != null &&
arrayCreationOperation.Initializer.ElementValues.Any(x => x is not ILiteralOperation))
if (arrayCreationOperation.Initializer is { } initializer &&
initializer.ElementValues.Any(x => x is not ILiteralOperation))
{
return;
}
Expand Down

0 comments on commit 1a70e89

Please sign in to comment.