Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Efficiency of VB vs C#

Posted on 2004-10-10
3
Medium Priority
?
384 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

A short article about problems I had with the new location API and permissions in Marshmallow
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
Introduction to Processes
Starting up a Project

610 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