VB.NET自动实现的属性——VS2010和VS2008的兼容性

标签 vb.net visual-studio-2008 visual-studio-2010 automatic-properties

我正在开发一个 ASP.NET 项目,我在 Visual Studio 2010 中使用 VB.NET。该项目的其他一些开发人员正在使用 Visual Studio 2008。我们都将我们的代码 checkin 单个 SVN 存储库。我想开始在 VB.NET 中使用自动实现的属性 ...

Property FirstName as String

而不是...

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

我担心的是,对于那些使用 VS2008 的人来说,这可能会造成困惑。如果使用 VS2008 的人需要修改我使用自动实现属性的类,会发生什么情况?我假设既然一切都编译成 IL 代码,那么二进制兼容性就不会有问题。虽然编辑源代码时会出现问题。我对此是正确的还是错误的?谢谢。

最佳答案

他们会得到一个编译错误

Property missing 'End Property'.

Property without a 'ReadOnly' or 'WriteOnly' specifier must provide both a 'Get' and a 'Set'.

关于VB.NET自动实现的属性——VS2010和VS2008的兼容性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5833415/

相关文章:

.net - 使用 .NET 解析 Diskpart 输出

sql - 如何在 Visual Studio 2008 中将 SQL Server 2008 R2 Express Advanced 和 With Tools 版本作为 ClickOnce 先决条件

c# - 在现有应用程序中使用 Silverlight

vb.net - Visual Basic 的多个问题

vb.net - 使用 VB.NET 检索 API JSON (https)(错误 : Canceled the request: Unable to create a secure SSL/TLS channel)

visual-studio-2008 - Visual Studio 2008 中的触摸输入

c# - 符合 DEP 要求的 Visual Studio 应用程序

visual-studio-2010 - 单元测试的测试文件放在哪里

visual-studio-2010 - 在 TFS 中,如何更正现有变更集上工作项的链接

vb.net - 如何创建 'OF' 变量类型?