|
-
Jan 25th, 2006, 11:39 AM
#1
Thread Starter
Hyperactive Member
VB and C#
I am now learning C# in class and already know alot on VB. I was wondering, Are there noticable benefits to using C# over VB? I was thinking performance would be better in C# but VB has a better verbose-type statement structuring making it easier to program an application far faster.
Thoughts?
Currently Using: VS 2005 Professional
-
Jan 25th, 2006, 11:55 AM
#2
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 25th, 2006, 11:59 AM
#3
Re: VB and C#
Learning C# will be easy since you know VB.NET already. While the rest of the posts in this thread will tell you about how C# performs better or is better than VB.NET for whatever pompous reasons, the thing you have to keep in mind is that your job prospects increase if you know both languages.
-
Jan 25th, 2006, 12:04 PM
#4
Thread Starter
Hyperactive Member
Re: VB and C#
Well, I have a passion for programming and I want to learn everything I cann about everything I can. I do, however, like to stick to a primary skillset that is most beneficial in the aspects I need it to be.
I have been reprogramming a SQL DB application I recently started from VB to C# and noticed that C# seems to run faster, at least from inside the IDE. Syntax is about the only thing I am struggling with, but with 2 classes of C++ from earlier in college I am not struggling as much as I thought I would.
Are there performance benefits in certain types of applications that C# will prevail over VB in? For example, maybe in web applications, or database applications, etc.
Thanks to all those who reply!!
Currently Using: VS 2005 Professional
-
Jan 25th, 2006, 01:08 PM
#5
Fanatic Member
Re: VB and C#
Well you can use unsafe code in C# which can speed up certain operations. But in spirit of Mendhak's post it's mostly a matter of preference.
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
-
Jan 25th, 2006, 01:12 PM
#6
Thread Starter
Hyperactive Member
Re: VB and C#
Are pointers considered unsafe code? I have little experience in pointers from my C++ classes. My thoughts are that the use of pointers in function calls would certainly give performance gains and protect against memory leaks because you are not creating a whole new object.
Thoughts?
Currently Using: VS 2005 Professional
-
Jan 25th, 2006, 01:16 PM
#7
Fanatic Member
Re: VB and C#
yeah in C# you can only use pointers inside an unsafe{} block, also a compiler directive must be set.
And I doubt it would help with memory leaks.
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
-
Jan 25th, 2006, 08:20 PM
#8
Thread Starter
Hyperactive Member
Re: VB and C#
So you cannot put a pointer variable in the arguments of the function you are calling? I know you could in C++.
Currently Using: VS 2005 Professional
-
Jan 25th, 2006, 08:27 PM
#9
Re: VB and C#
 Originally Posted by tacoman667
I was thinking performance would be better in C# but VB has a better verbose-type statement structuring making it easier to program an application far faster.
Funny you should mention that, as that's exactly what the difference is supposed to be. VB was designed as a language that the non-technical user can get up and running with very quickly. C# is easier to deal with than C/C++, but retains much of the power of those languages. Generally speaking the difference in execution speed between the two languages in neglible to zero. There are situations, though, where C# can provide significant speed increases. The main reason for this is the ability to use pointers, but some C# code is inherently more efficient than the equivalent VB.NET because of the very syntax you mention. Like so many things, what is a weakness in one situation is a strength in another, and vice-versa. For the average developer the difference between the two languages is purely which syntax you prefer.
-
Jan 25th, 2006, 08:31 PM
#10
Thread Starter
Hyperactive Member
Re: VB and C#
For the power user, the choice would be C#?
Can C# stand up to the abilities of C++?
Currently Using: VS 2005 Professional
-
Jan 25th, 2006, 09:27 PM
#11
Re: VB and C#
Not exactly, but close. C++ will still reign in speed and capabilities. It even supports inline assembly. Not sure if C# supports assembly though.
-
Jan 26th, 2006, 07:37 AM
#12
Thread Starter
Hyperactive Member
Currently Using: VS 2005 Professional
-
Jan 26th, 2006, 07:46 AM
#13
Re: VB and C#
Personally, i often use both.
VB as the main app or "front-end" as i feel it is a much much more friendly language, and a DLL in C# for the nitty gritty code.
As for your IDE being faster comment, you will notice that's because VB will tell you within seconds that what you have done will not compile, where as in C# it will not tell you until you actually go and compile it, thats why c# runs faster in the IDE.. as Jm points out this is one of thsoe things that has a + and -
Also, do not choose C# purely because you think your code will be faster, and especially do not use unsafe code if you do not need to, because it is exactly that, considered unsafe. You have a large operation you need to boost performance on (i am talking something that you will actually notice a delay on which will bother a user) than yes, thes emeasures are appropriate, if you are talking operations which happen instantianously anyway, there is no need.
-
Jan 26th, 2006, 09:36 AM
#14
Thread Starter
Hyperactive Member
Re: VB and C#
How about DB programming? Would performance be better in that area in C# over VB? I know VB is pretty quick in that but I will have DB's with well over 500000 records at times.
Currently Using: VS 2005 Professional
-
Jan 26th, 2006, 09:53 AM
#15
Re: VB and C#
that has to do with the Database software you are dealing with, not the language connecting to it, the DBMS is the one running the query, not your application.
-
Jan 26th, 2006, 05:16 PM
#16
Re: VB and C#
The majority of GUI applications will see no noticeable speed increase with C# over VB.NET because a GUI spends most of its time waiting for the user anyway. When you do something like retrieve large amounts of data from a database, all your code does is call Fill on a DataAdapter. The rest is up to the Framework and the database, so it is not affected at all by your code. Where you may see a speed benefit from using C# is in long, computationally intensive loops, where the slightly more efficient IL produced by the C# compiler in some cases will produce a speed increase that is compounded with each iteration of the loop. The other area is the ability to use unsafe code, as there are many operations that will receive a speed boost by using pointers. The use of pointers obviously makes coding more complex though, so that is the trade-off. If speed is critical then you should be using unmanaged C++. Assembly language is another jump closer to machine language so it will run faster again, so the ability to write assembly code directly into your C++ can give additional speed increases, at the expense of additional complexity again. If you will be performing operations that you know will benefit from the use of pointers then use unsafe C# code, Otherwise, the difference between C# and VB.NET will be pretty much negligible in the majority of cases.
-
Jan 26th, 2006, 05:20 PM
#17
Thread Starter
Hyperactive Member
Re: VB and C#
People keep saying that C# will do things that VB cannot. Can you give me an example of this?
Currently Using: VS 2005 Professional
-
Jan 26th, 2006, 05:43 PM
#18
Re: VB and C#
 Originally Posted by tacoman667
People keep saying that C# will do things that VB cannot. Can you give me an example of this?
Unsafe code is the major difference. C# supports pointers through unsafe code and VB.NET does not. C# also supports operator overloading but VB 2005 has added that now. I'm not aware of any other major differences, although I am not using C# much at the moment so others may be aware more differences, although I think any others would be minor.
-
Jan 26th, 2006, 05:53 PM
#19
Re: VB and C#
An example of somthing which utilises unsafe code and the speed of C# is NoteMe's and WossNames DoomSharp() project which aimed to create a 3d game without any hardware acceleration.
Pino
-
Jan 26th, 2006, 05:55 PM
#20
yay gay
Re: VB and C#
 Originally Posted by tacoman667
I am now learning C# in class and already know alot on VB. I was wondering, Are there noticable benefits to using C# over VB? I was thinking performance would be better in C# but VB has a better verbose-type statement structuring making it easier to program an application far faster.
Thoughts?
why does vb statement structuring make it easy to program far faster? I always thought it was exactly the OPPOSITE as you have to write far less in c# than you have to do in VB
\m/  \m/
-
Jan 26th, 2006, 05:58 PM
#21
yay gay
Re: VB and C#
 Originally Posted by tacoman667
People keep saying that C# will do things that VB cannot. Can you give me an example of this?
at least in the old VB you could not make operators overloading
\m/  \m/
-
Jan 26th, 2006, 05:59 PM
#22
Re: VB and C#
Isnt overloading a good thing?
also i suppose that somthings in vb take longer but som things in c# take longer for example there is no With statement in c#
-
Jan 27th, 2006, 12:33 AM
#23
Re: VB and C#
C# code can take much longer to debug and other team members to read, as it is a more cryptic language, VB is mostly words so very fast to read, and the IDE is always checking for errors in VB code.
why does vb statement structuring make it easy to program far faster? I always thought it was exactly the OPPOSITE as you have to write far less in c# than you have to do in VB
once again, because it is plain english, and we are IT pros, typing a word instead of a letter is not a big difference, it is thinking and testing time that we spend, not typing.
As i said before, they are both great tools in their own right, i use both. I think everyone should learn to fluently use both the languages, as they will both prove useful.
-
Jan 27th, 2006, 12:51 AM
#24
Re: VB and C#
 Originally Posted by Phill64
C# code can take much longer to debug and other team members to read, as it is a more cryptic language, VB is mostly words so very fast to read, and the IDE is always checking for errors in VB code.
I'm going to have to disagree with that. C# may be more difficult for a VB.NET developer to read, but no more or less so than VB.NET for a C# developer. It all comes down to your familiarity. If you're familiar with a C-based language already then C# is no more difficult to read than anything else. Any language, whether we're talking about programming languages or written languages like English, etc. are all just a series of symbols and indentifiers. Once you're familiar with those symbols and identifiers the rest is easy. VB was and is supposed to be easier for the less technically minded. It succeeds in that in part because of its more Engish-sentence-like syntax. Once you're experienced though that isn't really an advantage or disadvantage anymore.
-
Jan 27th, 2006, 09:13 AM
#25
Thread Starter
Hyperactive Member
Re: VB and C#
If that were the case, jmcilhinney, then why do'nt they just have 1-2 high-level languages instead of 4+? Say, C++ and VB?
Currently Using: VS 2005 Professional
-
Jan 27th, 2006, 09:29 AM
#26
Re: VB and C#
 Originally Posted by tacoman667
If that were the case, jmcilhinney, then why do'nt they just have 1-2 high-level languages instead of 4+? Say, C++ and VB?
All languages have their pros and cons. Each was created to fill a certain need. That doesn't mean that any one is specifically harder to read because of a cryptic syntax. If you know a language then you know it. It would take me a while to read Japanese but it would take just as long for many Japanese people to read English. It all comes down to familiarity. I have used VB.NET much more than C# but I have no more trouble reading C# code than VB.NET because of a C/C++ background. VB.NET is almost certainly easier for the beginner programmer to learn, but the statement I took issue with was:
 Originally Posted by Phill64
C# code can take much longer to debug and other team members to read, as it is a more cryptic language
as that will depend on who's doing the debugging and reading. A C++ developer with no VB.NET experience would take longer to read and debug VB.NET code than C#. Many people prefer the C-style syntax and specifically dislike the VB syntax.
-
Jan 27th, 2006, 10:39 AM
#27
Re: VB and C#
i can accept that. It is true i have only used C-syntax languages for Uni and hobby, all my commercial products (until i got into c#) have been VB, so i have used the VB syntax much more actively.
-
Jan 27th, 2006, 08:51 PM
#28
Re: VB and C#
I prefer C# because it is standardized.
-
Jan 27th, 2006, 10:41 PM
#29
Re: VB and C#
 Originally Posted by dee-u
I prefer C# because it is standardized. 
and VB isn't? well, classic VB definetly isnt, but VB.NET uses all the same objects as C#, and structures the same way, and the vb namespace is entirely optional.
unless you are refering to the operators
-
Jan 27th, 2006, 10:52 PM
#30
Re: VB and C#
 Originally Posted by Phill64
and VB isn't? well, classic VB definetly isnt, but VB.NET uses all the same objects as C#, and structures the same way, and the vb namespace is entirely optional.
unless you are refering to the operators
You can have a look at the first link given by Rob in post #2, it was one of the mitigating factors why I chose to learn C# more than VB.Net...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|