我最近工作的公司有一个程序员休假,他在VB中做了一个不再工作的WPF项目。我被指派修复该项目。我注意到的第一件事是他拥有的这些属性变量的构建错误。他们看起来像这样
Public Property BasePath As String = "this is a string to db properties"
Public Property header As New CurrentRun_HDR
Public Property PageHolder As New List(Of Page)
Public Property ScheduleHolder As New List(Of Page)
Public Property HeaderHolder As New List(Of Page)
Private Property LastUpdate As DateTime = Now
Private Property RefreshDate As DateTime = Now
Public Property MouseEnabled As Boolean = True
Visual Studio 2008表示属性需要get,set,所以我通过做这样的事情来满足第一个。
Private _Prop2 As String = "this is a string to db properties"
Property BasePath() As String
Get
Return _Prop2
End Get
Set(ByVal value As String)
_Prop2 = value
End Set
End Property
我不确定如何解决其他错误,例如下一个错误
Public Property header As New CurrentRun_HDR
它说新的在这种情况下不是有效的。当我用Google搜索它时,它表示你可以执行自动实现的属性,就像这个代码正在做,但是它们会在构建中抛出任何帮助,我们将非常感激。我在Visual Studio 2008中使用.Net Framework 3.5
我去过这个site
答案 0 :(得分:-1)