You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicFoo(T bar){if(bar==null)// Use 'Throw' expression here...{thrownewArgumentNullException(nameof(bar));}}
Error CS0019 Operator '??' cannot be applied to operands of type 'T' and '<throw expression>'
However, if I add a constraint on T in my class it works:
publicsealedclassFoo<TClass>whereTClass:class{}
Expected Behavior:
The "Use Throw expression" command should not be available or it should complain about the type. Maybe suggest adding the "where"-constraint above?
Actual Behavior:
Compilation error CS0019.
The text was updated successfully, but these errors were encountered:
Version Used: 15.2 (26430.4)
Steps to Reproduce:
Error CS0019 Operator '??' cannot be applied to operands of type 'T' and '<throw expression>'
However, if I add a constraint on T in my class it works:
Expected Behavior:
The "Use Throw expression" command should not be available or it should complain about the type. Maybe suggest adding the "where"-constraint above?
Actual Behavior:
Compilation error CS0019.
The text was updated successfully, but these errors were encountered: