繁体   English   中英

C#to VB.NET语法转换,用于具有属性的类实例化

[英]C# to VB.NET syntax conversion for class instantiation with properties

我正在使用Workflow Foundations 4(在C#中)并且我正在尝试编写VB.NET表达式。 有没有办法在一行上的VB.NET中执行以下操作?

SomeObj instance = new SomeObj()
{ 
    SomeStringProp = "a",
    SomeIntProp = 17
};

这是一个例子:

Dim instance = new SomeObj() With {
    .ISomeStringProp = "a", 
    .SomeIntProp = 17
}

如果您想了解更多信息,请查看VB.NET 9.0:对象和数组初始化器

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM