What does default(T) produce in a C# generic method?
Correct answer B. null for reference types and the zero value for value types
Explanation
default(T) returns the default value of whatever T turns out to be: null for reference types, 0 for numeric types, false for bool and a zeroed struct for other value types. It needs no constraint, which makes it the standard way to return 'no result' from generic code. Since C# 7.1 you can write just default when the type can be inferred.
Answer checked How we write and check questions
Discussion