C# 语法快捷方式
我想知道是否存在 C# 语法快捷方式的集合或列表。事情很简单,省略 if
语句上的大括号一直到 ??
合并运算符之类的事情。
I was wondering if there exists somewhere a collection or list of C# syntax shortcuts. Things as simple omitting the curly braces on if
statements all the way up to things like the ??
coalesce operator.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
是 的缩写
并且
是 的缩写
另请参阅 Visual Studio 中的代码模板,它可以让您加快编码速度。
但请注意,短代码并不一定意味着好的代码。
is short for
And
is short for
Also see the code templates in visual studio which allows you to speed coding up.
But note that short code doesn't mean necessarily good code.
我一直最喜欢的是
翻译成
My all time favorite is
which translates to
c# 6.0 有一些有趣的。
?.
和?
(空条件运算符)是我的最爱。var value = obj != null ? obj.property : null;
变成var
value = list != null ? list[0] : null;
变成
c# 6.0 has some fun ones.
?.
and?
(null conditional operator) is my favorite.var value = obj != null ? obj.property : null;
turns intoand
var value = list != null ? list[0] : null;
turns into
您觉得这个 C# 基本参考 pdf 文档怎么样?
这是另一个 pdf。
How does this C# basic reference pdf document looks to you?
Here's another pdf.
我不知道预编译列表,但 C# 参考 (尤其是 C# 关键字部分)如果您愿意阅读一些内容,则简明地包含您正在寻找的信息。
I don't know of a precompiled list, but the C# Reference (especially the C# Keywords section) concisely contains the information you're looking for if you're willing to read a bit.
它们不是语法快捷方式,但片段是很棒的编码快捷方式。例如,输入 prop (tab)(tab) 会删除属性所需的代码。
http://msdn.microsoft.com/en-us /library/ms165392(VS.80).aspx
They are not syntax shortcuts, but snippets are great coding shortcuts. Typing prop (tab)(tab), for example, stubs out the code you need for a property.
http://msdn.microsoft.com/en-us/library/ms165392(VS.80).aspx