Jump to content
Xtreme .Net Talk

Why the intellisense difference between C# and VB.NET?


Recommended Posts

Posted

Can anyone explain to me the difference between these two languages as far as the intellisense feature goes?

 

In VB.NET, when I type "Try" and hit enters it gives me the associated Try...Catch Block Code. However in C#, when I type "try" and hit ENTER intellisense didn't bring anything.

 

Another scenario is, in VB.NET, when I have declared a "Boolean" Type variable and if I were to initialize it, it gives me drop down list of {True, False} values to choose from. However in C#, when I declared a "bool" Type Variable and tried to initialize it, there is no intellisense values list shown to choose from.

 

what is the explanation on this difeerence in VS.NET? Is it just to be different from VB.NET? I am trying to self-convert from VB.NET to C# Programmer and would just like to know the story behind this...if there is one at all!!!

Posted

you're right... that annoys me too..

for example in vb.net, messagebox.show( brings up something like this:

MessageBox.show(strMessage as string, strCaption as String).. etc

but in C++

MessageBox( brings up

MessageBox.show(HWND hwnd, string STRMESSAGE, LP ..something) i dont remmeber off the top of my head..

 

yea that's annoying -

 

but back to your question, i have no idea why C# does that, but try pressing Ctrl + Space to get the drop down menu,

 

pent

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

Posted

I see a lot of threads trashing the VB Programmers as lazy programmers in most of the forums and I was beginning to wonder...if that was the reason. It that was so, I would have to say that VB.NET is more productive language since I can code way faster with the support of the intellisense. I am NOT taking sides on which program to use or to code in, since I am all about learning new stuff anyway -- unlike the most of die-hard "my-language-is-better" support groups. I am sure they can come up with better reason behind this intellisense thing.

 

I tried your suggestion with Ctrl + Space and it didn't do anything in C#. Hmmm...so much learn...

Posted

C# is a brand new language for the .NET environment, while VB has been long enough in the market to get many features C# lacks of.

One of this features is the intellisense help, but also remember that C# as C++ is a case sensitive language in C# XX and xx are two diff things while in VB they're the same, so you don't get the help you need if you don't write correctly the name of the class / routine / variable / etc.

Also, the way you declare a variable is diff, in VB you declare it "Dim XX as String", after you type the AS an intellisense combo appears giving you the options you need, how can that be done in C# or C++ when you first declare the type and then the name of the variable "string XX;", maybe what Pent suggested can be a cool feature for C#, but for the moment it lacks of it, also some other features like the ones commented by Eng, an autocomplete feauture.

For me C# has enough power to compete against other languages in the market, I like C# more than VB, besides, I can write an app faster in C# than in VB, it's not true that the intellisense makes you more productive. Take for example a string variable declaration

In C# will be like this:

string MyVariable="";

 

In VB will be like this:

Dim MyVariable As String = ""

 

so far in C# I only pressed 21 times the keyboard (yeah you have to type the whole thing) while in in VB I pressed 22 times the keyboard and looked for the data type in a list, if I count the times I pressed the down arrow, will be like 65 times before getting the one I need, if I type a couple letters before selecting the data type just add the characters, let's supposed I typed "str" and then the space bar to get it from the intellisense, that will make it 26 times, 5 more than in C#.

Your productivity is not measured on how fast you type or get a funciton /routine ready, is how complete and well done your work is, I can work only in 1 routine the whole day, but when it's tested, you get zero bugs from it and does what it's supposed to do.

Developing can be very tricky, intellisense feature makes your life simpler, but at the end your expirience and skills will tell how productive you are.

Fat kids are harder to kidnap
Posted

Thanks...your point is well taken. I was looking for more of the explanation on "Why" when I posted the question...not on "What is 'productive'?". Now...I am curious on "How does one measure experience and skills?"

 

However, my expression about the "Productivity" was not really measured by key strokes as you've mentioned. I came from totally different program background than VB or C/Java related language like. I started out with SAS Programming -- which is who really cares to know:-) With no background in VB (so I am not taking sides), when I started programming in VB.net about a year ago, I was able to learn and solve problem much faster since the help of intellisense and autocomplete were at the end of my finger tips (as I pressed "." and the drop-down of all the choice or as I type in "Try" and know somewhat of what the code is expecting...with less keystrokes).

 

I guess it is the sort of thing that MS tries to differentitate with VS.Net -- on the type of coders...the ones who like to type a lot and the ones who don't. I would probably be spending most of my time fixing syntax if I have to type a lot. :-) (There goes the productivity.)

Posted

Well, I used that example, but I guess was a bad one, what I meant is that you can be productive with any language if you know what you want to do and the language syntax, if you're a guru in VB and you have a big project and little time to finish it, will be a really bad idea to start working on C# (for example).

Intellisense is a strong point on VS, but it can be improved in every language, it's not that I like to type too much, but sometimes you spend more time fixing the code you typed because you did it wrong or someone did it wrong (tell me about it).

I don't think there's a way to measure experience and skills, but you can use a simple rule to know if the person is a good developer, but you can test the person, see his resumee, ask for references.

But anyway, going back to your main question, C# is more like (d'oh) C, so Intellisense will not work the same way as VB, declarations of variables is pretty different (the C way), but you can always create your own add-ins to help you with your common tasks, this is a feature in VS that almost no one uses.

Fat kids are harder to kidnap
  • *Experts*
Posted

I, too, wish that C#'s intellisense were a little smarter. There's no (good) reason why C# couldn't support intellisense for "true/false" on something like this:

bool b =

 

(after typing the "=" sign have intellisense show the values "true/false".)

 

Likewise, having a variable declared as an enum and setting it should offer a nice way to fill in the enum name for you. For example:

MyEnumType var =

(after type the "=" sign intellisense could let you press Tab and fill in the word "MyEnumType." and show the dropdown.)

 

Similarly, typing "if" and pressing space could fill in "if ()" and leave the cursor inside the parentheses. The XML editor offers similar functionality when adding attributes.

 

The only disadvantage I see with this, and it's VERY minor, is that newcomers to a language might not fully learn some of the constructs. For example, typing in "Try" and having intellisense giving you a "Catch" block. A newcomer to VB.NET might not know that you can have just a try/finally block (no catch). I use these often, especially when changing the Cursor on a Windows Form. It's a minor hazzard and I doubt MS left out some intellisense options for this reason :)

 

We can only hope for Whidbey (.NET 2005) to enhance some of these options. I have the Technical release right now so I'll find out tonight - be jealous :)

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...