C#.net和Visual Basic.net有什么区别?

时间:2022-04-27 17:18:08

I have a small experience in VB.net and I would like to learn C#.net

我在VB.net有一点经验,我想学习C#.net

What are the differences between VB.net and C#.net?

VB.net和C#.net之间有什么区别?

Is there any difference in performance between these two?

这两者之间的表现有什么不同吗?

Apart from the syntactical differences, are there any major changes that I have to keep in mind?

除了语法上的差异之外,我还要记住哪些重大变化吗?

6 个解决方案

#1


The Language Features section of the Wikipedia article offers a good overview. Performance is essentially equivalent in almost every aspect, from what I understand.

*文章的语言功能部分提供了一个很好的概述。从我的理解,几乎在每个方面,性能基本上是等同的。

#2


Performance is equivalent if you write equivalent code, but VB.NET has constructs that are in there for "backward compatibility" which should NEVER be used. C# doesn't have some of these things. I'm thinking specifically of:

如果你编写等效的代码,性能是相同的,但VB.NET的构造在那里是为了“向后兼容”,永远不应该使用。 C#没有这些东西。我特意想到:

  • Functions which are in the Microsoft.VisualBasic namespace which are members of other standard .NET classes like Trim(). The .NET classes are often faster.

    Microsoft.VisualBasic命名空间中的函数,它们是Trim()等其他标准.NET类的成员。 .NET类通常更快。

  • Redim and Redim Preserve. Never to be used in .NET, but there they are in VB.

    Redim和Redim Preserve。永远不要在.NET中使用,但它们在VB中。

  • On Error ... instead of exceptions. Yuck!

    On Error ...而不是异常。呸!

  • Late binding (sometimes derisively called "Option Slow"). Not a good idea in a non-dynamic .NET language from a performance perspective.

    后期绑定(有时被嘲弄地称为“选项慢”)。从性能角度来看,在非动态.NET语言中不是一个好主意。

VB is also missing things like automatic properties which makes it pretty undesirable for me. Not a performance issue, but worth keeping in mind.

VB也缺少像自动属性这样的东西,这对我来说非常不利。不是性能问题,但值得记住。

#3


I think you will find the answers to your question in this articles:

我想你会在这篇文章中找到你问题的答案:

http://en.wikipedia.org/wiki/Comparison_of_C_sharp_and_Visual_Basic_.NET

and

http://geekswithblogs.net/jmccarthy/archive/2007/01/23/104372.aspx

edit: Noldorin was faster :x

编辑:Noldorin更快:x

#4


The first thing to know about learning C# is that it is not pronounced "C#.net", it is just C#. Microsoft tacked on ".NET" to VB, because there was a previous version of VB that didn't work on the .NET Framework. C# was created specifically with the .NET Framework in mind, so the ".net" is implied and unnecessary. Also as a side note putting "C#.NET" on your resume really tips off a knowledgeable manager to your skill level, or lack there of, regarding C#.

学习C#的第一件事是它不是发音为“C#.net”,它只是C#。微软将“.NET”加入VB,因为有一个以前版本的VB无法在.NET Framework上运行。 C#是专门为.NET Framework创建的,因此“.net”是隐含的,不必要的。另外,作为一个侧面说明,在你的简历中加入“C#.NET”真的会让一位知识渊博的经理知道你的技能水平,或者缺乏关于C#的技能水平。

Also this Wikipedia article is really good for showing the pros and cons as well as the differences between C# and VB.NET at a high level.

此*文章也非常适合在高级别上展示C#和VB.NET之间的优缺点以及差异。

#5


Follow following links which give detailed differences

请按照以下链接进行详细说明

http://www.harding.edu/fmccown/vbnet_csharp_comparison.html

http://www.codeproject.com/KB/dotnet/vbnet_c__difference.aspx

http://support.microsoft.com/kb/308470

In spite of differences as mentioned at http://support.microsoft.com/kb/308470 both C# and VB.Net are first class citizens of .Net world

尽管在http://support.microsoft.com/kb/308470中提到了差异,但C#和VB.Net都是.Net世界的一等公民

Although there are differences between Visual Basic .NET and Visual C# .NET, both are first-class programming languages that are based on the Microsoft .NET Framework, and they are equally powerful. Visual Basic .NET is a true object-oriented programming language that includes new and improved features such as inheritance, polymorphism, interfaces, and overloading. Both Visual Basic .NET and Visual C# .NET use the common language runtime. There are almost no performance issues between Visual Basic .NET and Visual C# .NET. Visual C# .NET may have a few more "power" features such as handling unmanaged code, and Visual Basic .NET may be skewed a little toward ease of use by providing features such as late binding. However, the differences between Visual Basic .NET and Visual C# .NET are very small compared to what they were in earlier versions.

虽然Visual Basic .NET和Visual C#.NET之间存在差异,但它们都是基于Microsoft .NET Framework的一流编程语言,并且它们同样强大。 Visual Basic .NET是一种真正的面向对象的编程语言,包括新的和改进的功能,如继承,多态,接口和重载。 Visual Basic .NET和Visual C#.NET都使用公共语言运行库。 Visual Basic .NET和Visual C#.NET之间几乎没有性能问题。 Visual C#.NET可能具有一些“强大”功能​​,例如处理非托管代码,而Visual Basic .NET可能会因为提供后端绑定等功能而略微偏向易用性。但是,与早期版本相比,Visual Basic .NET和Visual C#.NET之间的差异非常小。

#6


No matter which language you select based on your personal preference and past experience, both languages are powerful developer tools and first-class programming languages that share the common language runtime in the .NET Framework.

无论您根据个人偏好和过去的经验选择哪种语言,这两种语言都是强大的开发人员工具和一流的编程语言,它们共享.NET Framework中的公共语言运行库。

Says by Microsoft https://support.microsoft.com/en-us/kb/308470

由微软https://support.microsoft.com/en-us/kb/308470说

#1


The Language Features section of the Wikipedia article offers a good overview. Performance is essentially equivalent in almost every aspect, from what I understand.

*文章的语言功能部分提供了一个很好的概述。从我的理解,几乎在每个方面,性能基本上是等同的。

#2


Performance is equivalent if you write equivalent code, but VB.NET has constructs that are in there for "backward compatibility" which should NEVER be used. C# doesn't have some of these things. I'm thinking specifically of:

如果你编写等效的代码,性能是相同的,但VB.NET的构造在那里是为了“向后兼容”,永远不应该使用。 C#没有这些东西。我特意想到:

  • Functions which are in the Microsoft.VisualBasic namespace which are members of other standard .NET classes like Trim(). The .NET classes are often faster.

    Microsoft.VisualBasic命名空间中的函数,它们是Trim()等其他标准.NET类的成员。 .NET类通常更快。

  • Redim and Redim Preserve. Never to be used in .NET, but there they are in VB.

    Redim和Redim Preserve。永远不要在.NET中使用,但它们在VB中。

  • On Error ... instead of exceptions. Yuck!

    On Error ...而不是异常。呸!

  • Late binding (sometimes derisively called "Option Slow"). Not a good idea in a non-dynamic .NET language from a performance perspective.

    后期绑定(有时被嘲弄地称为“选项慢”)。从性能角度来看,在非动态.NET语言中不是一个好主意。

VB is also missing things like automatic properties which makes it pretty undesirable for me. Not a performance issue, but worth keeping in mind.

VB也缺少像自动属性这样的东西,这对我来说非常不利。不是性能问题,但值得记住。

#3


I think you will find the answers to your question in this articles:

我想你会在这篇文章中找到你问题的答案:

http://en.wikipedia.org/wiki/Comparison_of_C_sharp_and_Visual_Basic_.NET

and

http://geekswithblogs.net/jmccarthy/archive/2007/01/23/104372.aspx

edit: Noldorin was faster :x

编辑:Noldorin更快:x

#4


The first thing to know about learning C# is that it is not pronounced "C#.net", it is just C#. Microsoft tacked on ".NET" to VB, because there was a previous version of VB that didn't work on the .NET Framework. C# was created specifically with the .NET Framework in mind, so the ".net" is implied and unnecessary. Also as a side note putting "C#.NET" on your resume really tips off a knowledgeable manager to your skill level, or lack there of, regarding C#.

学习C#的第一件事是它不是发音为“C#.net”,它只是C#。微软将“.NET”加入VB,因为有一个以前版本的VB无法在.NET Framework上运行。 C#是专门为.NET Framework创建的,因此“.net”是隐含的,不必要的。另外,作为一个侧面说明,在你的简历中加入“C#.NET”真的会让一位知识渊博的经理知道你的技能水平,或者缺乏关于C#的技能水平。

Also this Wikipedia article is really good for showing the pros and cons as well as the differences between C# and VB.NET at a high level.

此*文章也非常适合在高级别上展示C#和VB.NET之间的优缺点以及差异。

#5


Follow following links which give detailed differences

请按照以下链接进行详细说明

http://www.harding.edu/fmccown/vbnet_csharp_comparison.html

http://www.codeproject.com/KB/dotnet/vbnet_c__difference.aspx

http://support.microsoft.com/kb/308470

In spite of differences as mentioned at http://support.microsoft.com/kb/308470 both C# and VB.Net are first class citizens of .Net world

尽管在http://support.microsoft.com/kb/308470中提到了差异,但C#和VB.Net都是.Net世界的一等公民

Although there are differences between Visual Basic .NET and Visual C# .NET, both are first-class programming languages that are based on the Microsoft .NET Framework, and they are equally powerful. Visual Basic .NET is a true object-oriented programming language that includes new and improved features such as inheritance, polymorphism, interfaces, and overloading. Both Visual Basic .NET and Visual C# .NET use the common language runtime. There are almost no performance issues between Visual Basic .NET and Visual C# .NET. Visual C# .NET may have a few more "power" features such as handling unmanaged code, and Visual Basic .NET may be skewed a little toward ease of use by providing features such as late binding. However, the differences between Visual Basic .NET and Visual C# .NET are very small compared to what they were in earlier versions.

虽然Visual Basic .NET和Visual C#.NET之间存在差异,但它们都是基于Microsoft .NET Framework的一流编程语言,并且它们同样强大。 Visual Basic .NET是一种真正的面向对象的编程语言,包括新的和改进的功能,如继承,多态,接口和重载。 Visual Basic .NET和Visual C#.NET都使用公共语言运行库。 Visual Basic .NET和Visual C#.NET之间几乎没有性能问题。 Visual C#.NET可能具有一些“强大”功能​​,例如处理非托管代码,而Visual Basic .NET可能会因为提供后端绑定等功能而略微偏向易用性。但是,与早期版本相比,Visual Basic .NET和Visual C#.NET之间的差异非常小。

#6


No matter which language you select based on your personal preference and past experience, both languages are powerful developer tools and first-class programming languages that share the common language runtime in the .NET Framework.

无论您根据个人偏好和过去的经验选择哪种语言,这两种语言都是强大的开发人员工具和一流的编程语言,它们共享.NET Framework中的公共语言运行库。

Says by Microsoft https://support.microsoft.com/en-us/kb/308470

由微软https://support.microsoft.com/en-us/kb/308470说