Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
331 views
in Technique[技术] by (71.8m points)

c# - C#的隐藏功能? [关闭](Hidden Features of C#? [closed])

This came to my mind after I learned the following from this question :

(从这个问题中学到以下内容后,我想到了这一点 :)

where T : struct

We, C# developers, all know the basics of C#.

(我们C#开发人员都知道C#的基础知识。)

I mean declarations, conditionals, loops, operators, etc.

(我的意思是声明,条件,循环,运算符等。)

Some of us even mastered the stuff like Generics , anonymous types , lambdas , LINQ , ...

(我们中有些人甚至掌握了泛型匿名类型lambdasLINQ等...)

But what are the most hidden features or tricks of C# that even C# fans, addicts, experts barely know?

(但是,即使C#爱好者,成瘾者,专家也几乎不知道C#最隐藏的功能或技巧是什么?)

Here are the revealed features so far: (到目前为止,这里是一些揭示的功能:)


Keywords (关键词)

Attributes (属性)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This isn't C# per se, but I haven't seen anyone who really uses System.IO.Path.Combine() to the extent that they should.

(这本身不是C#,但是我还没有见过真正使用System.IO.Path.Combine()的人。)

In fact, the whole Path class is really useful, but no one uses it!

(实际上,整个Path类确实很有用,但是没有人使用它!)

I'm willing to bet that every production app has the following code, even though it shouldn't:

(我敢打赌,每个生产应用程序都具有以下代码,即使它不应该具有以下代码:)

string path = dir + "\" + fileName;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...