BadCats
@BadCats

Что означает эта строка?

ВОТ ЭТА СТРОКА: b = default(T);
  • Вопрос задан
  • 176 просмотров
Решения вопроса 1
Nipheris
@Nipheris Куратор тега C#
default(T) вычисляется как дефолтовое значение для типа T.

Given a variable t of a parameterized type T, the statement t = null is only valid if T is a reference type and t = 0 will only work for numeric value types but not for structs.The solution is to use the default keyword, which will return null for reference types and zero for numeric value types.For structs, it will return each member of the struct initialized to zero or null depending on whether they are value or reference types.
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
Ввел в гугле
c# default
Первая ссылка ведет на офиц документацию .
Совпадение? Скорее всего...
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы