Why cannot convert null to type parameter T in c#?
问题 I'm converting a bunch of code from VB to C# and I'm running in to an issue with a method. This VB method works great: Public Function FindItem(ByVal p_propertyName As String, ByVal p_value As Object) As T Dim index As Int32 index = FindIndex(p_propertyName, p_value) If index >= 0 Then Return Me(index) End If Return Nothing End Function It allow the return of Nothing(null) for T. The C# equivalent does not work: public T FindItem(string p_propertyName, object p_value) { Int32 index =