Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Variable declaration question mark

Tags:

vb.net

I was looking at some existing code and stumbled across a variable declaration I didn't understand:

public foo as Boolean?

What does the question mark signify?

like image 921
Mav Avatar asked Jul 08 '10 22:07

Mav


2 Answers

It means a nullable Boolean.

Boolean?, or any other value type (number or struct), is shorthand for Nullable(Of Boolean).

like image 155
SLaks Avatar answered Nov 09 '22 17:11

SLaks


aah, no sooner did I post the question that I realised that it may signify that it can be nullable.

I tested in code and that seems to be the case.

like image 2
Mav Avatar answered Nov 09 '22 19:11

Mav