TheDevTeam

VB equivalent of the C# ? operator

In C# you can quickly do if statements by using the ‘?’ operator, and check for null values by using the ‘??’ operator.

This is done with the following syntax:

int i = 1;
string result;
i > 1 ? result = "i is greater than one" : result = "i is one or less";

 

The same shorthand coding style can be achieved in VB.Net (since 2008) by using the IIf function as follows:

Dim i as Integer? = 1
Dim result as String
' C# '?' equivalent
IIf(i > 1, result = "i is greater than one", result = "i is one or less")
' Or C# '??' equivalent
IIf(i is nothing, result = "i is null!", result = "i is a number")
Read more about Dave Radley on

Related to VB equivalent of the C# ? operator

Postcode Profiler

Find out what is going on in your Post Code

Data for Microsoft Power Bi

With the amount of data available to you growing exponentially, we're here to help you make sense of it all. There are now many business intelligence tools available from companies such as Microsoft, Google and Tableau but you'll need experts in data analysis if you want to make sense of it. That's where we fit in.

Eclipse Page Counter

Our O&M Manuals division collate vast quantities of information for inclusion in the H&S manuals for the construction industry.


Knowledge Base

Data for Microsoft Power Bi

With the amount of data available to you growing exponentially, we're here to help you make sense of it all. There are now many business intelligence tools available from companies such as Microsoft, Google and Tableau but you'll need experts in data analysis if you want to make sense of it. That's where we fit in.

Eclipse EMail PowerBI Reporting Example

Eclipse EMail is available to all organisations, regardless of whether or they already exist as clients of TheDevTeam. Integrate your email services with all your other business data. Well structured, targeted campaigns can be finely tuned and developed as you learn to interpret the wealth of information that's generated as a result.

PowerBI digger production example using Eclipse

There are literally thousands of different types of reports you can extract from our mining production tracking system: Eclipse Miningware. This article is a brief demonstration of just one; a daily report for the diggers which worked in production "yesterday".

Software Development Skills

Productivity in software development has improved even faster than the hardware - Moore's Law - double the power every 18 months.

Address:
The Dev Team
8 The Lawn,
St Leonards-On-Sea,
East Sussex, TN38 0HH