关于 VB.NET 中 Obsolete 特性的问题
2009-08-26 20:29 晓风残月 阅读(1009) 评论(0) 编辑 收藏 举报在 Visual Studio 2008 SP1 (包含)之前,如果你编译下面的代码,会得到 BC30668 错误,但同样的代码,VC# 一开始就没有这个问题。我想VC#是合理的,因为在调用堆栈上,如果所有的方法都标识为 Obsolete 也就不算错误了。
<Obsolete("This procedure has been obsoleted", True)> _
Public Sub Foo()
Foo(0) ' HERE!! error BC30668: 'Public Sub Foo(arg1 As Integer)' is obsolete: 'This procedure has been obsoleted'.
End Sub
<Obsolete("This procedure has been obsoleted", True)> _
Public Sub Foo(ByVal arg1 As Integer)
End Sub
现在VB.NET这个问题,已经在 Visual Studio 2010 Beta2 解决,详见讨论:Can I disable the BC30668 compiler error resulted in ObsoletedAttribute?