Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以在 vb.net 中将With关键字与多个类对象/控件一起使用?
我可以像这样使用它:
With something .property = value End With
但是,是否可以将它与多个类对象一起使用?
不,这是不可能的,你可以嵌套它们,但仅此而已:
With something1 .property1 = value With something2 .property2 = .property1 'something2.property2 = something1.property1 End Width End With
而且这种方式很容易迷路,尤其是对象之间有共同属性的情况下,不推荐。