-1

What is the equivalent for this in VB.net

int? x;

int s;

s = x ?? 5;
ST3
  • 8,826
  • 3
  • 68
  • 92
Yasser-Farag
  • 592
  • 4
  • 9
  • 28

2 Answers2

2

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

s = If(x, 5)
Igoy
  • 2,942
  • 22
  • 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
  • 62,401
  • 13
  • 102
  • 153