Bill
Bill

Reputation: 135

VB.NET: Why doesn't this nullable work?

dim str as nullable(of string)

is this syntax incorrect?

Upvotes: 0

Views: 158

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1500375

Nullable(Of T) is only applicable to non-nullable value types. String is a class - a reference type. A variable of type String can already have a null value.

Upvotes: 7

Related Questions