Default value to a optional class variable parameter function call in vb.net -
i trying pass class variable optional parameter function. requires default value. set default value optional class variable.
private function savefruit(optional byval tempbanana bananaclass = ?)
reference types' default value nothing
(the null
reference).
private function savefruit(optional byval tempbanana bananaclass = nothing) if tempbanana nothing tempbanana = otherdefaultbanana ..... end function
as shown in example above have check if it's nothing
is
-operator before can use it, otherwise nullreferenceexception
. can either assign instance exists or 1 initialize now.
Comments
Post a Comment