Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1381
  • Last Modified:

C sharp versus Visual Basic

I have decided to recreate an old Access application into the new .NET infrastructure.

Have a medium understanding of Visual Basic

Wondering if I should do it in C Sharp for the sake of learning a bit or Visual Basic.

Can someone please tell me what they think and why, and also can someone give an explination of VB versus C#?

Thanks

Bryan
0
bryanford
Asked:
bryanford
  • 5
  • 3
  • 3
  • +4
3 Solutions
 
Carl TawnSystems and Integration DeveloperCommented:
As of .Net 2 there is very little between them. VB.Net is going to be easier to learn if your from a VB6 background. C# on the other hand is gaining popularity and there seem to be more resources on the web focused on C#.

At the end of the day it comes down to a personal preference.
0
 
ikeworkCommented:
c# is an open standard, not under control of m*crosoft, vb is. the support in the visual studio ide is better for c#, there they put new features first and if they anytime have to decide one not to support anymore, it will be vb. so in aspect of your personal career and the lots of resources in the net, as carl_town mentioned already, i recommend going for c# ..

but good luck anyway :))
ike
0
 
Arthur_WoodCommented:
It really is entirely up to you.  If you truly want the learning experience, and to be able to say that you are comfortable with C#, then take that path - however, be aware that there is a learning curve to overcome - since C# is CASE_SENSITIVE (int MyVar = 0;  and int myVar = 1; will declare and instantiate TWO (2) separate variables, which in VB.NET would have been a single variable - or you would have gotten a compiler error, since you are declariing the SAME variable twice, in VB.NET)

C# does not have anything like the VB.NET With...End With construct.

C# uses ; to terminate a code line (which can therefore be extended over multiple lines, without the need for the VB.NET _ as a continuation character)

C# uses {...}  to enclose blocks of code

C# uses the construct

if (MyVar == 1)
{
   // do soemthing if true
}
else
{
  // do something else if false
}
Notice the use of == as the BOOLEAN Equality operator

this list goes on and on...

But go for it.  The learning experience will be good for you, in the long run.

AW
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ghostReckonCommented:
both languages are very similar in terms of their potential. One may not have a few features that the other has and vise vesa but it will have work around to it. Both language are very demanding and help is available freely for both. So use the language you are confortable with. Cheers
0
 
ikeworkCommented:
>> both languages are very similar in terms of their potential

i don't agree there .. C# has now generics, c++ programmers call it templates .. that's a very big difference ...
0
 
ghostReckonCommented:
ikework, The original question was for comparing between c# and VB and not c# and C++ (what you mentioned above).

Bryan, It is very easy to make switch between VB and C# and vise vesa.

0
 
bryanfordAuthor Commented:
Thanks for all your answers so far. I think I will end up going the C# way.

i think ikework was basically saying that C# has generics (which C++ call templates) and VB doesnt. Correct? What are generics anyway?

Also is there much difference between C# and C++?
0
 
Arthur_WoodCommented:
ikework>>"C# has now generics,"  so does VB.NET in VS 2005.
0
 
Arthur_WoodCommented:
Generics allow you to build a sort routine, without needing to know what KIND of this is being sorted, for example.

The sorting algorithm is determined by the TYPE of the object being sorted.

AW
0
 
ghostReckonCommented:
ikework>>"C# has now generics,"  so does VB.NET in VS 2005.

This is Absolutly true. ikework, maybe you were talking about VS2003
0
 
ikeworkCommented:
>> i think ikework was basically saying that C# has generics (which C++ call templates) and VB doesnt. Correct?

bryanford, ya, thank you for clearify my point ... it was early in the morning :)


so you say, vb has generics too? if so ignore my point ...

>> What are generics anyway?

generics are a mechanism to implement algorithms without knowing the underlying type, lets say it generalizes an algorithm and you can instanciate it for *each* type you want. for instance a linked list is implemented once, since it doesnt change, no matter what data it holds, without ugly casts and variants.

ike
0
 
MogalManicCommented:
You also want to look at the Access application you are going to convert.  If there is alot of custom VBA code, then it might be quicker converting the custom code to VB.Net:
http://msdn.microsoft.com/office/default.aspx?pull=/library/en-us/odc_vsto2003_ta/html/vbaconvert.asp

0
 
arthurmnevCommented:
overall in .NET everything gets translated to MSIL, an intermediate language that gets compiled in the end
This is not to say there is no difference between the languages:
1) Syntax, C# is MUCH more flexible with things like pointer manipulation (as hindered as it is in .NET you can still do it), for some operations it becomes extremely useful.
2) Additional operators such as bit shifting i.e.

int x = 123;
x >> 12; // shift to the right by 12 bits.
Once again, this is not something you need on every day use, but when you need it and it is not available, it is a pain.

3) C like / Java like syntax - if you are looking for examples, Java developers have tons of them out there, syntax between java and c# is so close that you can literaly copy/paste and change upper/lower case and viola - applications will compile

when i needed to get red-black binary search tree implemented, rather then write it from scratch, I just got someone's java code and optimized it to what i needed it to be (yeah, i know it is cheating but it took me 30 minutes in total -:) )

finally as someone mentioned above, generics:


public void myfunction<T>(T customtypevariable)
{
Console.WriteLine(T.GetType().Name);
}

T is a custom time, that is, when you would call a function:

myfunction<int>(123); or
myfunction<string>("abcd");

this way the function can work differently based on data types supplied.

if you declare those two lines within your code, behind the scenes the compiler will write out two functions:

public void myfunction(int parameter);
public void myfunction(string parameter);

highly useful if you are writing reusable code.
0
 
ikeworkCommented:
what about operator-overloading ... very useful feature to make code more readable and intuitive .. do both have it?
0
 
Carl TawnSystems and Integration DeveloperCommented:
Its available in both in 2.0, don't know if its available in VB for 1.0/1.1
0
 
ikeworkCommented:
cool ... seems both became adults.. ;-))
0
 
Carl TawnSystems and Integration DeveloperCommented:
Yup, as of 2.0, VB and C# support pretty much the same stuff.
0
 
bryanfordAuthor Commented:
thanks for all your help guys...

Ive decided to give the C# a shot... i mean, if i cant work something out, intelisense will give me an error i can EE later on right?? hehe.

Ive divied up the points as best i could. It was hard trying to work out who to give them to...

Thanks again!

Bryan
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 5
  • 3
  • 3
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now