-1

What is the equivalent for this in VB.net

int? x;

int s;

s = x ?? 5;
ST3
  • 8,410
  • 3
  • 64
  • 90
Yasser-Farag
  • 590
  • 4
  • 9
  • 28

2 Answers2

2

if() operator is the null coalescing operator in vb.

s = If(x, 5)
Igoy
  • 2,782
  • 19
  • 23
2

There are three ways in vb.net for nullable declaration

Dim x? As Integer
Dim x As Integer?
Dim x As Nullable(Of Integer)


Dim s As Integer

s = If(x, 5)
Damith
  • 60,955
  • 13
  • 99
  • 152