-4

what does this declaration mean :

int ? value 

and what is he's equivalent on VB.NET .

Thanks

user1187282
  • 1,137
  • 4
  • 14
  • 23

9 Answers9

3

It means that this integer is nullable, you can assign a null value to it... try to do that with an integer without a ? and it with throw an exception

Edit: Oh and VB.net will declare a nullable int like this

    Dim i As Integer?
Mikey Mouse
  • 2,968
  • 2
  • 26
  • 44
2

int? is short for Nullable<int>. The VB.NET equivalent is Nullable(Of Integer).

wgraham
  • 1,383
  • 10
  • 16
2

It's declaring a new instance of the Nullable<Int32> type. int? is just a shorter way of writing it.

Further Reading

p.s.w.g
  • 146,324
  • 30
  • 291
  • 331
2

It is a Nullable<int> data type.

The equivalent in vb is Dim value as Nullable(Of Integer) or Dim value as Integer?

Tom Studee
  • 10,316
  • 4
  • 38
  • 42
2

It's syntatic sugar for

Nullable<int> value

meaning that it can have a null value

daz-fuller
  • 1,191
  • 1
  • 10
  • 18
1

Nullable value types. It means that the variable can contain a null value. For more details both for VB.NET and C#.NET view this link http://msdn.microsoft.com/en-us/library/ms235245.aspx

Mez
  • 4,666
  • 4
  • 29
  • 57
1

It a nullable int and is a short term of

Nullable<int> value;

In VB.net you would write

dim value as Nullable( of Integer )

See this msdn page for more details and examples.

Matten
  • 17,365
  • 2
  • 42
  • 64
1

Try to read about nullable on msdn (http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx)

Frank59
  • 3,141
  • 4
  • 31
  • 53
1

The question mark refers to nullable type in C#. You can try using Nullable (Of Integer) in VB.NET.

Ispep Aloc
  • 83
  • 6