Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Basic equivalent of C# type check

Tags:

c#

vb.net

What is the Visual Basic equivalent of the following C# boolean expression?

data.GetType() == typeof(System.Data.DataView) 

Note: The variable data is declared as IEnumerable.

like image 554
Steven Avatar asked Apr 12 '10 20:04

Steven


People also ask

Is Visual Basic similar to C?

1. C is a programming language for general purpose computers; VB is an event driven programming language that was designed to make computer programming easier for programming beginners.

Is Visual Basic C based?

It is pronounced as Visual Basic . NET, which is an updated feature and version of Classic Visual Basic 6.0. It is pronounced as "C SHARP" language, that belongs to the C family. It is also used to develop various applications running on the .

Is Visual Basic like C++?

In brief, Visual Basic refers to a programming language while Visual C++ refers to an IDE. The main difference between Visual Basic and Visual C++ is that Visual Basic is an Object Oriented Programming Language while Visual C++ is an Integrated Development Environment (IDE).


1 Answers

As I recall

TypeOf data Is System.Data.DataView 

Edit:
As James Curran pointed out, this works if data is a subtype of System.Data.DataView as well.

If you want to restrict that to System.Data.DataView only, this should work:

data.GetType() Is GetType(System.Data.DataView) 
like image 186
Powerlord Avatar answered Sep 21 '22 03:09

Powerlord