C#C
C#2y ago
Gramore

Co-varient array warning.

I'm getting a warning about co-variant conversion from ExpressionElementSyntax[] to CollectionElementSyntax[] when using AddElements() on a CollectionExpressionSyntax.
Isn't this required by the API since CollectionElementSyntax is abstract?
---
For context:
  • This is a resharper warning
  • As far as I understand it this is safe since the array is just used in an AddRange() anyway
  • Full message: Co-variant array conversion from ExpressionElementSyntax[] to CollectionElementSyntax[] can cause run-time exception on write operation
Was this page helpful?