开发者

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

I am working with Workflow Foundations 4 (开发者_StackOverflowin C#) and am trying to write a VB.NET expression. Is there a way to do the following in VB.NET on one line?

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


Here's an example:

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

If you want more info take a look at VB.NET 9.0: Object and Array Initializers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜