VB equivalent for C#’s default(T)

It’s any of these:

Dim variable As T
Dim variable As T = Nothing
Dim variable As New T()
Dim variable As T = CType(Nothing, T) 'this is suggested by reflector

Assigning Nothing even to value types is perfectly fine in VB.NET. And the latter is only possible if you specify either New, or Structure constraint for the generic type.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)