ошибка CS1503: Аргумент 1: невозможно преобразовать из '' в 'T?'
Код: Выделить всё
public class MyClass where T : notnull
{
// This is the only reason for the T:notnull constraint
private Dictionary myDict = new();
// Just because the dictionary key isn't nullable,
// doesn't mean I shouldn't be able to declare a function
// that takes the nullable type T?
public void foo(T? val)
{
}
public MyClass()
{
foo(null); // CS1503
}
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... lable-type
Мобильная версия