473,714 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What the diffirence between C# and VB.net?



--
----------------
Simon Peng
xq****@tsinghua .org.cn
Nov 15 '05 #1
7 1807
There are some differences between VB.NET and C#

VB.NET doesn't support operator overloading.
VB.NET doesn't support define #region within a method body.
VB.NET doesn't support indexer.
etc.

look for details
http://www.advisor.com/Articles.nsf/aid/SHERP42
-------------------------
"Manish Agarwal"- <ma***********@ hotmail.com>
http://personal.vsnl.com/mkag
If replying to the group, please do not mail me.
"Simon Peng" <xq****@tsinghu a.org.cn> wrote in message
news:#F******** ******@tk2msftn gp13.phx.gbl...


--
----------------
Simon Peng
xq****@tsinghua .org.cn

Nov 15 '05 #2
Manish,
VB.NET doesn't support indexer.


Sure it does.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Nov 15 '05 #3
One is full of assumptions and bugs waiting to happen and the other other is
very anal/strict/less-bug-prone... :o)
"Fergus Cooney" <wo****@tesco.n et> wrote in message
news:OS******** ******@TK2MSFTN GP10.phx.gbl...
Hi Simon,

One's Brilliant!!, the other's Great!!

Yours [unhelpfully :-)]
Fergus

Nov 15 '05 #4
I believe the syntax in VB.NET is "Default Property" as opposed to indexer,
but it's the same thing:
Default Property Item(ByVal index as Integer) As String
--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com
"Mattias Sjögren" <ma************ ********@mvps.o rg> wrote in message
news:O$******** ******@TK2MSFTN GP09.phx.gbl...
Manish,
VB.NET doesn't support indexer.


Sure it does.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.

Nov 15 '05 #5
In a nutshell, I believe VB.NET to be for a) supporting legacy VB 6 users,
and b) for rapid-application development. In versions 2002-03 of VS, I
don't see many differences in RAD between VB.NET and C#, but I believe the
next versions of the IDE will reflect a bigger difference. (Microsoft says
vb is for task-based programming, while c# is for code-based programming,
whatever that means. I only write code to perform tasks!). What I think
it means is that while the C# team worked on generics, the vb.net team
brought back edit & continue, and added some really cool error-checking as
you code. (Almost like ms word's grammar & spelling check as you type). I
already think the VB.NET IDE is much better than the C# IDE, and it is
advancing further ahead.

In addition to operator overloading and the #region within a method body
(which I didn't realize to be a difference, nor do I think to be a very good
idea), here are some other differences:

1. C# by default supports XML comments (there are currently plugins for
VB.NET xml comments, and the next version will support it natively). This
is a huge plus for C# at the moment - especially when combined with ndoc.

2. VB.NET has a simpler syntax for some event handlers (especially useful
for GUIs) since they have the keyword "handles"
e.g.
MySub(Object sender, EventArgs e) Handles Button1.Clicked
blah blah
End Sub
no need for a line Button1.Clicked += new EventHandler(My Sub)

3. VB.NET is a bit more verbose in other ways, using End Sub instead of
just } - note that the IDE generally provides the End Sub / End Fucntion /
End If automagically as soon as you start a block, so you probably type
about the same amount. Implementing properties in vb.net is really easy
with the ide - it adds the get/set methods as soon as you type the property
declartion.

4. Case sensitivity - VB.NET isn't case sensitive. This has it's advantages
and disadvantages. I like this for RAD because as I'm typing (all
lowercase) I can see it automatically recase to ProperPascalCas e or
camelCase. If it doesn't recase, it means I misspelled something. I don't
like the case insensitivity because I like to use case to define scope. For
instance, a public property named Color may use a private variable color,
both of type Color. In VB.NET, you're forced to name the private variable
something else, like myColor or m_Color.

5. VB.NET has support for some "archaic" vb things that you probably
shouldn't be using in new code, but that might be useful for portability.
The terrible "On Error Resume" and such is still available in VB.NET. Also
ReDim Preserve for resizing arrays and preserving the contents (which just
copies the array contents to a new array, I believe, but the syntax *may* be
cleaner). VB.NET can also define arrays to have non 0 based indices, but
these are strongly discouraged. There's an entire dll of vb things (which
are also available in C# if you need them) specifically for legacy code.

6. VB.NET has an Option Strict On/Off which changes how typesafe the
compiler forces you to be. (C# is always quite typesafe)

7. VB.NET supports optional arguments on methods.

8. C# supports unsigned integer types (you can't add two unsigned ints in
VB.NET, for instance).

9. C# supports "unsafe" code, i.e. you can still use pointers if you need.
(really useful for image manipulation).

10. ; in C# - which is REALLY NICE. Otherwise, in VB.NET, you have to use
_ when a statement runs over the end of a line, which seems to make my VB
code have really long lines that go past the end of the screen and makes the
code much harder to read.

11. The VB.NET IDE is much nicer. Especially for intellisense, trying to
override base class methods, and adding event handlers. And the
error-reporting as you code is way ahead in VB.NET.

12. Possible difference in salary of a developer (historically C++ paid more
than VB, not sure where C# will fall in the spectrum).

13. Future differences: C# will support generics, don't think VB.NET will
(soon anyways)

Finally, and probably the most important of all: C# is more familiar for
anybody who has a C/C++/Java background. VB.NET is more familiar for
anybody who has a VB background. Pick the one that fits either your past
experience or future plans (do you want to be a Java/.NET developer, C# is
probably better. Do you come from a history of VB6 / COM programming?
VB.NET will probably be better). They both have access to the entire FCL
(Framework Class Library) so things like opening a file, reading its
contents, performing a regular expression replace on the contents, and
posting the results to a web page will be virtually identical between the
two languages.

--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com
Nov 15 '05 #6
Michael Mayer <mi**@mag37.com > wrote:
13. Future differences: C# will support generics, don't think VB.NET will
(soon anyways)


I believe it'll have it in the same release that C# does. From
http://msdn.microsoft.com/vstudio/pr...p.aspx#whidbey

<quote>
Finally, for the more advanced Visual Basic developer, language
enhancements include support for operator overloading, unsigned data
types, inline XML-based code documentation, and partial types. In
addition, developers using Visual Basic will have access to a type-
safe, high-performance, compile time-verified version of generics that
promote code reuse across a variety of data types.
</quote>

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #7
"Jon Skeet" <sk***@pobox.co m> wrote in message
news:MP******** *************** @news.microsoft .com...
Michael Mayer <mi**@mag37.com > wrote:
13. Future differences: C# will support generics, don't think VB.NET will (soon anyways)


I believe it'll have it in the same release that C# does. From
http://msdn.microsoft.com/vstudio/pr...p.aspx#whidbey

<quote>
Finally, for the more advanced Visual Basic developer, language
enhancements include support for operator overloading, unsigned data
types, inline XML-based code documentation, and partial types. In
addition, developers using Visual Basic will have access to a type-
safe, high-performance, compile time-verified version of generics that
promote code reuse across a variety of data types.
</quote>


Wow, that's outstanding. Didn't realize they were adding so much of that -
I even read that article, but I must have skipped that paragraph. I might
be tempted to go back to VB.NET (that was my first exposure to .NET before I
discovered C#). I would miss {}'s and ;'s since my "real" background is
C++.

Wonder if they'll have the new iterators as well? I didn't see that
mentioned in the article.

mike
Nov 15 '05 #8

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

Similar topics

2
3091
by: thecrow | last post by:
Alright, what the hell is going on here? In the following code, I expect the printed result to be: DEBUG: frank's last name is burns. Instead, what I get is: DEBUG: frank's last name is burns. Here is the code: $frank = "burns";
220
19067
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it seems that Ruby has the potential to compete with and displace Python. I'm curious on what basis it...
699
33988
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
92
6493
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption? cheers, reed
137
7124
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very pragmatic - 3) I usually move forward when I get the gut feeling I am correct - 4) Most likely because of 1), I usually do not manage to fully explain 3) when it comes true. - 5) I have developed for many years (>18) in many different environments,...
12
11165
by: Dario | last post by:
The following simple program behaves differently in Windows and Linux . #include <stdexcept> #include <iostream> #include <string> using namespace std; class LogicError : public logic_error { public: string desc;
125
14781
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
47
9146
by: Neal | last post by:
Patrick Griffiths weighs in on the CSS vs table layout debate in his blog entry "Tables my ass" - http://www.htmldog.com/ptg/archives/000049.php . A quite good article.
86
7781
by: Michael Kalina | last post by:
Because when I asked for comments on my site-design (Remember? My site, your opinion!) some of you told me never to change anything on font-sizes! What do you guys think of that: http://www.clagnut.com/blog/348/ I hope that's going to be a good discussion! Michael
0
8817
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9322
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9092
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9037
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7963
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5964
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4472
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3170
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.