随着块相当于在C#中? [英] With block equivalent in C#?
本文介绍了随着块相当于在C#中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道VB.Net,我试图刷了我的C#。有没有带块相当于在C#?
I know VB.Net and am trying to brush up on my C#. Is there a With block equivalent in C#?
感谢
推荐答案
虽然C#没有任何直接等同于一般的情况下,C#3增益对象初始化语法构造函数调用:
Although C# doesn't have any direct equivalent for the general case, C# 3 gain object initializer syntax for constructor calls:
var foo = new Foo { Property1 = value1, Property2 = value2, etc };
请参阅C#的深度8章 - 详情。你可以从曼宁的网站
See chapter 8 of C# in Depth for more details - you can download it for free from Manning's web site.
(声明 - 是的,这是我的兴趣让这本书成为更多人的手中但是,嘿,这是一个免费的章节,让你在一个相关主题的详细信息...。)
(Disclaimer - yes, it's in my interests to get the book into more people's hands. But hey, it's a free chapter which gives you more information on a related topic...)
这篇关于随着块相当于在C#中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文