简体   繁体   English

VB.NET 自动实现的属性 - VS2010 和 VS2008 之间的兼容性

[英]VB.NET Auto-Implemented Properties - Compatibility between VS2010 and VS2008

I am working on an ASP.NET project where I use VB.NET within Visual Studio 2010. Some of the other developers on the project are using Visual Studio 2008. We all check our code into single SVN repository.我正在开发一个 ASP.NET 项目,我在 Visual Studio 2010 中使用 VB.NET。该项目中的其他一些开发人员正在使用 Visual Studio 2008。我们都将我们的代码检查到单个 Z6BF57FB535CA7C628954DFB9CA7F 存储库中I would like to start using Auto-Implemented Properties within VB.NET...我想开始在 VB.NET 中使用自动实现的属性...

Property FirstName as String

instead of...代替...

Private FirstName as String
  Public Property FirstName() As String
  Get
    Return _FirstName
  End Get
  Set(ByVal value As String)
    _FirstName = value
  End Set
End Property

My concern is that this could mess up things for those using VS2008.我担心的是,对于那些使用 VS2008 的人来说,这可能会搞砸事情。 What would happen if someone using VS2008 needed to modify my class that made use of Auto-Implemented Properties?如果有人使用 VS2008 需要修改我使用自动实现属性的 class 会发生什么? I am assuming that since everything compiles down to IL code then there would be no issue in binary compatibility.我假设由于所有内容都编译为 IL 代码,因此二进制兼容性不会有问题。 Though a problem would arise when editing source.虽然在编辑源代码时会出现问题。 I am a correct or mistaken on this?我对此是正确的还是错误的? Thank you.谢谢你。

They will get a compilation error他们会得到一个编译错误

Property missing 'End Property'.属性缺少“结束属性”。

Property without a 'ReadOnly' or 'WriteOnly' specifier must provide both a 'Get' and a 'Set'.没有“ReadOnly”或“WriteOnly”说明符的属性必须同时提供“Get”和“Set”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM