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
The sample below shows two problems: 1. T is actually constrained to a class type, so return null should be ok
2. Adding ! did not supress this warning
publicclassC{public T M<T>()whereT:C{returnnull!;// warning CS8625: Cannot convert null literal to non-nullable reference or unconstrained type parameter.}}
The text was updated successfully, but these errors were encountered:
jcouv
changed the title
Adding ! fails to suppress warning
Adding ! fails to suppress warning, and shouldn't be need for async method anyways
May 4, 2018
jcouv
changed the title
Adding ! fails to suppress warning, and shouldn't be need for async method anyways
Adding ! fails to suppress warning
May 4, 2018
! should suppress the warning (that is a valid bug), but since T is constrained to a reference type, the method could be declared as returning T? to avoid the warning.
The sample below shows two problems:
1.T
is actually constrained to a class type, soreturn null
should be ok2. Adding
!
did not supress this warningThe text was updated successfully, but these errors were encountered: