473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

(Beginner) VB.NET piece of code, How is it coded in C#?

Hello Fellows,

Can you let me know how do i convert the below VB.NET piece of code into c#?

Dim targetTypes(0) as Type
targetTypes(0) = GetType(Order)

Thanks :)
Nov 16 '05 #1
4 1206
NewBie wrote:
Hello Fellows,

Can you let me know how do i convert the below VB.NET piece of code into c#?

Dim targetTypes(0) as Type
targetTypes(0) = GetType(Order)


Type[] targetTypes = new Type[1];
targetTypes[0] = GetType(Order);

FB, who wonders what this has to do with ADO.NET ;)

--
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP
Nov 16 '05 #2
[raising hand and waving wildly]
I do! I do!

--
<%= Clinton Gallagher
A/E/C Consulting, Web Design, e-Commerce Software Development
Wauwatosa, Milwaukee County, Wisconsin USA
NET csgallagher@ REMOVETHISTEXT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

"Frans Bouma [C# MVP]" <pe******************@xs4all.nl> wrote in message
news:xn***************@msnews.microsoft.com...
NewBie wrote:
Hello Fellows,

Can you let me know how do i convert the below VB.NET piece of code into c#?

Dim targetTypes(0) as Type
targetTypes(0) = GetType(Order)


Type[] targetTypes = new Type[1];
targetTypes[0] = GetType(Order);

FB, who wonders what this has to do with ADO.NET ;)

--
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP

Nov 16 '05 #3
Hi FB,
Thanks for the reply, i had tried that but i get the below compilation error...
'NameSpace.Order' denotes a 'class' where a 'variable' was expected.
Then realised that get type takes in a string, (type name) in C#

BTW.. ADO.NET? i posted the Q in the NG "microsoft.public.dotnet.languages.csharp"

Tnx once again...
"Frans Bouma [C# MVP]" wrote:
NewBie wrote:
Hello Fellows,

Can you let me know how do i convert the below VB.NET piece of code into c#?

Dim targetTypes(0) as Type
targetTypes(0) = GetType(Order)


Type[] targetTypes = new Type[1];
targetTypes[0] = GetType(Order);

FB, who wonders what this has to do with ADO.NET ;)

--
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP

Nov 16 '05 #4

The VB.NET GetType() function is called typeof() in C#

Your example then becomes:
Type[] targetTypes = new Type[1];
targetTypes[0] = typeof(Order);

or shorter:

Type[] targetTypes = new Type[] {typeof(Order)};

"NewBie" <Ne****@discussions.microsoft.com> wrote in message
news:FF**********************************@microsof t.com...
Hi FB,
Thanks for the reply, i had tried that but i get the below compilation error... 'NameSpace.Order' denotes a 'class' where a 'variable' was expected.
Then realised that get type takes in a string, (type name) in C#

BTW.. ADO.NET? i posted the Q in the NG "microsoft.public.dotnet.languages.csharp"
Tnx once again...
"Frans Bouma [C# MVP]" wrote:
NewBie wrote:
Hello Fellows,

Can you let me know how do i convert the below VB.NET piece of code into c#?
Dim targetTypes(0) as Type
targetTypes(0) = GetType(Order)


Type[] targetTypes = new Type[1];
targetTypes[0] = GetType(Order);

FB, who wonders what this has to do with ADO.NET ;)

--
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Rod Carrol | last post by:
Hello all, As a beginner I've been exeperiencing lots of errors while building my website, (I'm currently attempting to implement a member login/registration piece for my site using mySQL and...
4
by: David | last post by:
Hello , I'm trying to parse an XML document a get spicific tags such as email in the code below. I'm using xerces 2.4. However I don't manage to get the value for the email. Can anybody help. ...
3
by: jacksonaaronc | last post by:
Greetings, I am in need of two things. First, I need a list of good resources for someone that wishes to learn XML. If there are any defacto books, URL, etc I would love to know where to...
2
by: Alex | last post by:
Hello I am interested learn more about .NET but am uncertain of exactly what niche it fills in the world of programming. (The more I read the more I am confused). What I am looking for is the...
4
by: Spam Me Please | last post by:
I have a tree like this struct BTree{ int left; char c; int right; }; #define END -1 int main(int argc, char *argv)
12
by: Blaze | last post by:
I am doing the first walk through on the Visual Studio .Net walkthrough book to learn a little about programming. I am having issues with the first tutorial not running correctly. It seems that...
8
by: Scott Schluer | last post by:
Hello, I'm fairly experience with VB.NET in so far as it's syntax is concerned, however I'm coming from a web-based environment. Typically, when I want to store data (i.e. user preferences,...
13
by: pepito3 | last post by:
Hi. I have a question about PHP programming philosophy: Imagine a web of a shop with a table displaying the name of some products. There is a link "Buy" next to each product. I want that link to...
22
by: ddg_linux | last post by:
I have been reading about and doing a lot of php code examples from books but now I find myself wanting to do something practical with some of the skills that I have learned. I am a beginner php...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.