C#

C#

By DeepSource

Consider using the default literal over default(T) CS-R1097

Anti-pattern
Autofix

The default(T) expression returns whatever the default value is for the type T depending on whether it is a value type or a reference type. Using the default literal accomplishes the exact same thing and is easier to read.

Examples

Bad Practice

public T t = default(T);

Recommended

public T t = default;