Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
default(T) evaluates to the default value for type 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.
Entered in Google
c# default
The first link leads to the official documentation.
Coincidence? More likely...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question