Solved

Efficiency of VB vs C#

Posted on 2004-10-10
3
352 Views
Last Modified: 2008-02-26
I already know vb.net and I am taking the plunge to learn C#.  My question is this; Say I write two identical programs (performs the same tasks and looks the same) , one in VB.net and one in C#.  Is there a speed difference between the two programs?  I have heard C# is more efficient than VB.  Please clue me in on this. Thanks.
0
Comment
Question by:hunterdnance
3 Comments
 
LVL 18

Expert Comment

by:JR2003
ID: 12271656
I don't see that C# would be anymore efficient than VB.NET. For each VB.NET line there is an equivalent in C# and the .NET compiler should compile then to the same .NET framework common language code.
0
 
LVL 3

Accepted Solution

by:
KeithWatson earned 500 total points
ID: 12271778
The only significant difference between C# and Visual Basic with respect to performance is that C# allows you to declare "unsafe" sections of code (given the correct compiler options). Unsafe code allows you to manipulate memory directly using pointers, much as language like C and C++ do. Using pointers, there is the potential to improve performance in certain circumstances; the tradeoff being that it's more difficult to program and easier to introduce defects, which can often be tricky to track down.

However, your question assumes you write identical programs. They both compile into MSIL, so give or take any failures in the compilers, there's no reason why one would run faster than the other.
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 12271917
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to split this in C++ 4 102
Counting documents in a Domino View 3 83
sp_configure 'external scripts enabled', 1; 7 50
How to Convert a Quote to an Order in SalesForce 2 40
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question