在 C#
我可以做这个:
new SomeObjectType("abc", 10);
换句话说,我可以在不将创建的实例分配给任何变量的情况下调用 new。然而,在
VB.Net
看来我不能做同样的事情。New SomeObjectType("abc", 10) ' syntax error
有没有办法在
VB.Net
中做到这一点? ?
最佳答案
查看其他答案 SO Answer
所以这应该有效:
With New SomeObjectType("abc", 10)
End With
关于VB.Net调用New而不赋值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3015489/