Property as string Nullable by default by ThinqLinq

Property as string Nullable by default

It appears that the string parameter of a method is Nullable by default under 2.0. I am having cases where my UI using the new object binding is returning Nothing to a property Set declared as below:

Public Property MyValue() as String

Set(ByVal value as string)

'value may be Nothing/Null here rather than an empty string

End Set

...

End Property

Thus any action you take on the value will need to check for nothing first (including Trim, ToUpper, etc). This is particularly problematic when binding to comboboxes which allow for no selection. In 1.0/1.1 no selection allowed for an empty string. 2.0 returns a null string.

Posted on - Comment
Categories: VB -
comments powered by Disqus