为什么不VB.NET 9具有自动属性,如C#3? [英] Why doesn't VB.NET 9 have Automatic Properties like C# 3?

查看:184
本文介绍了为什么不VB.NET 9具有自动属性,如C#3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应该有一个很好的小功能,使得它更快地编写类似自动属性的代码非常适合很好地与VB.NET的口头禅?



这样的事情会工作完美的:

 公共财产姓()作为字符串
得到

高端物业

更新: VB.NET 10(与Visual Studio 2010和.NET未来4.0)将自动属性。下面是显示了有关功能的小信息的链接: http://geekswithblogs.net/DarrenFieldhouse/archive/2008/12/01/new-features-in-vb.net-10-.net-4.0.aspx



在VB.NET 10自动属性会是这样定义:

 公共财产CustomerID作为整数


解决方案

原因之一许多功能在VB中被延迟是发展的结构比在C#中,此外,往往更多的思考进入细节太大的不同。相同的似乎是真的在这种情况下,通过在保罗维克的帖子的建议物。这是不幸的,因为这意味着在许多情况下延迟(自动属性,迭代方法,多行lambda表达式,仅举几例),但在另一方面,VB开发人员通常会得到从长远来看,一个更成熟的功能(看,讨论,这将是迭代方法,尤其如此)



所以,长话短说:!VB 10(希望)见自动属性


Would having a nice little feature that makes it quicker to write code like Automatic Properties fit very nicely with the mantra of VB.NET?

Something like this would work perfect:

Public Property FirstName() As String
    Get
    Set
End Property

UPDATE: VB.NET 10 (coming with Visual Studio 2010 and .NET 4.0) will have Automatic Properties. Here's a link that shows a little info about the feature: http://geekswithblogs.net/DarrenFieldhouse/archive/2008/12/01/new-features-in-vb.net-10-.net-4.0.aspx

In VB.NET 10 Automatic Properties will be defines like this:

Public Property CustomerID As Integer

解决方案

One reason many features get delayed in VB is that the development structure is much different than in C# and additionally, that often more thought goes into details. The same seems to be true in this case, as suggested by Paul Vick's post on the matter. This is unfortunate because it means a delay in many cases (automatic properties, iterator methods, multiline lambdas, to name but a few) but on the other hand, the VB developers usually get a much more mature feature in the long run (looking at the discussion, this will be especially true for iterator methods).

So, long story short: VB 10 will (hopefully!) see automatic properties.

这篇关于为什么不VB.NET 9具有自动属性,如C#3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆