Compare Vb.net and C#

  • Thread starter Prateek Sethi[GrapeCity]
  • Start date
P

Prateek Sethi[GrapeCity]

Hi,

Can somebody let me know the differences between vb.net and C# or point me
to an article? I do not need syntax and keyword differences, but an insight
on the funtionality diff. between the two languages/compilers.

Thanks
 
S

sridhar

There are not much differences as functionality and
compilers.MS aim is Language independent. But vey minor
Diff.are exist like

1) we cann't write unmanaged code using VB but it is
possible with C#.

2)C# has XML Comments that allow you to stick XML into the
code to make it self-documenting. This isn't actually a
feature of C#, it's just that someone neglected VB.NET
when they put it in, but it is a smart feature to use when
you want to quickly document assemblies and applications.

3)VB gained >> and << bitwise operators in the latest
version, although it still can't work with unsigned types
so their usefulness is limited.

4)VB has optional parameters, C# doesn't
5)C# has operator overloading, VB doesn't
6)late binding implementation at VB is very easy compared
to C#.

you can also see : support.microsoft.com/?kbid=308470
 
J

Jon Skeet

sridhar said:
There are not much differences as functionality and
compilers.MS aim is Language independent. But vey minor
Diff.are exist like

1) we cann't write unmanaged code using VB but it is
possible with C#.

No it's not. You can write *unsafe* code with C#, but it's still
managed. There's a big difference between unmanaged and unsafe.
 
P

Prateek

Thanks a lot Sridhar!! This is a great help..

There are not much differences as functionality and
compilers.MS aim is Language independent. But vey minor
Diff.are exist like

1) we cann't write unmanaged code using VB but it is
possible with C#.

2)C# has XML Comments that allow you to stick XML into the
code to make it self-documenting. This isn't actually a
feature of C#, it's just that someone neglected VB.NET
when they put it in, but it is a smart feature to use when
you want to quickly document assemblies and applications.

3)VB gained >> and << bitwise operators in the latest
version, although it still can't work with unsigned types
so their usefulness is limited.

4)VB has optional parameters, C# doesn't
5)C# has operator overloading, VB doesn't
6)late binding implementation at VB is very easy compared
to C#.

you can also see : support.microsoft.com/?kbid=308470
 
P

Prateek

Thanks to all..

While on the same topic, I would like to give some background of this
question..

I have found that there is a difference in how C# and VB.NET compliers treat
overloaded methods in the derived class. While VB.NET looks for the best
fit, C# fits in the method call to the derived class member if that is
possible. Take a look at the two samples below. Run these and notice the
difference. I would be glad if you could throw some light on this or point
out if I am doing something wrong here.

Thanks,
Prateek

------------------------------------------
//CSubtle.cs
using System;

public class SubtleBase
{
public void Great(int i)
{
Console.WriteLine ("You are in Base:Great Integer " + i.ToString());
}

public void Great(String i)
{
Console.WriteLine ("You are in Base:Great String " + i.ToString());
}
}

public class SubtleDerived : SubtleBase
{
public void Great(Object i)
{
Console.WriteLine ("You are in Derived:Great Object " + i.ToString());
}

public static void Main()
{
int i = 45;
String s = "This is a string";
Object o = "This is an object";

SubtleDerived obj = new SubtleDerived();

obj.Great(i);
obj.Great(s);
obj.Great(o);
}
}
------------------------------------------

------------------------------------------
'VSubtle.vb

Imports System

Public class SubtleBase
public sub Great(i as Integer)
Console.Writeline ("You are in Base:Great Integer " + i.ToString)
End Sub

public sub Great(i as String)
Console.Writeline ("You are in Base:Great String " + i.ToString)
End Sub
End Class

Public Class SubtleDerived
Inherits SubtleBase

public overloads sub Great(i as object)
Console.Writeline ("You are in Derived:Great Object " + i.ToString)
End Sub

public shared Sub Main()
Dim i as Integer = 45
Dim s as String = "This is a string"
Dim o as Object = "This is an object"
Dim obj as new SubtleDerived

obj.Great(i)
obj.Great(s)
obj.Great(o)
End Sub
End Class
------------------------------------------



Hi,

Can somebody let me know the differences between vb.net and C# or point me
to an article? I do not need syntax and keyword differences, but an insight
on the funtionality diff. between the two languages/compilers.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top