我有以下内容。
Public Structure Foo
dim i as integer
End Structure
Public Class Bar
Public Property MyFoo as Foo
Get
return Foo
End Get
Set(ByVal value as Foo)
foo = value
End Set
dim foo as Foo
End Class
Public Class Other
Public Sub SomeFunc()
dim B as New Bar()
B.MyFoo = new Foo()
B.MyFoo.i = 14 'Expression is a value and therefore cannot be the target of an assignment ???
End Sub
End Class
我的问题是,为什么我不能通过Bar类中的属性来赋值给i?我做错了什么?
i
的保护/可访问级别是相关的,但我同意这不是问题。 - Jodrell