TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

C# 7.0 – What to Expect

105 点作者 chachram将近 9 年前

10 条评论

dodyg将近 9 年前
This article is out of date.<p>Feature such as With expression has been pushed to version 7+. They have also trim down the ambition of pattern matching for c# 7.<p>The best way to keep track of C# 7 feature is through their public roadmap <a href="https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;roslyn&#x2F;blob&#x2F;master&#x2F;docs&#x2F;Language%20Feature%20Status.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;roslyn&#x2F;blob&#x2F;master&#x2F;docs&#x2F;Language%2...</a>
vmarsy将近 9 年前
The feature below amazing, I wonder how Visual studio will display it, I like it when above Properties it adds the ref count across the Solution:<p><pre><code> 3 references public int Damage { get; } 4 references public int Durability { get; } public class Sword(int Damage, int Durability); </code></pre> This single line will result in a fully functional class:<p><pre><code> public class Sword : IEquatable&lt;Sword&gt; { public int Damage { get; } public int Durability { get; } public Sword(int Damage, int Durability) { this.Damage = Damage; this.Durability = Durability; } public bool Equals(Sword other) { return Equals(Damage, other.Damage) &amp;&amp; Equals(Durability, other.Durability); } public override bool Equals(object other) { return (other as Sword)?.Equals(this) == true; } public override int GetHashCode() { return (Damage.GetHashCode() * 17 + Durability.GetHashCode()) .GetValueOrDefault(); } public static void operator is(Sword self, out int Damage, out int Durability) { Damage = self.Damage; Durability = self.Durability; } public Sword With(int Damage = this.Damage, int Durability = this.Durability) =&gt; new Sword(Damage, Durability); }</code></pre>
danielvf将近 9 年前
C# continues its tradition of stealing the good stuff from other languages. I&#x27;m really impressed. Pattern matching and immutable objects? This is great!
评论 #11962082 未加载
评论 #11962078 未加载
评论 #11962047 未加载
评论 #11962564 未加载
algorithmsRcool将近 9 年前
Amoungst other things, this article covers Pattern Matching, Record Types and Non-Nullable Reference types. All of which are great features but all of which will likely not be in C# 7 unfortunately due to shipping timelines [0].<p>0: <a href="https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;roslyn&#x2F;blob&#x2F;master&#x2F;docs&#x2F;Language%20Feature%20Status.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;roslyn&#x2F;blob&#x2F;master&#x2F;docs&#x2F;Language%2...</a>
jmartinpetersen将近 9 年前
Object orientation and pattern matching is not an obvious mix. A lot of OO is about dependency inversion, which is more or less the exact opposite of what pattern matching gives you. It can be a powerful tool in the right hands but could also lead to absolute horror. Sometimes it feels like Mads and co. are too focused on making C# functional-like and in the process encourages a lot of foot-shooting.
评论 #11963279 未加载
greenspot将近 9 年前
Since I haven&#x27;t see many new Windows apps the recent years, who is actively developing new apps in C# and if yes, what kind of apps, which platforms, etc.? Is it mainly games?
评论 #11962257 未加载
评论 #11962289 未加载
评论 #11962612 未加载
评论 #11962119 未加载
评论 #11962773 未加载
评论 #11962437 未加载
评论 #11964769 未加载
评论 #11962290 未加载
评论 #11962932 未加载
评论 #11962252 未加载
algorithmsRcool将近 9 年前
In addition to the new language features there are some very exciting new APIs being designed at: <a href="https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;corefxlab" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;corefxlab</a><p>Including a new higher performance&#x2F;lower allocation text formatting API: <a href="https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;corefxlab&#x2F;wiki&#x2F;System.Text.Formatting" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dotnet&#x2F;corefxlab&#x2F;wiki&#x2F;System.Text.Formatt...</a>
srean将近 9 年前
No biggie, but I do miss rotate, partition, nth_element from STL. Its just that when I came to C# i came with an expectation that it would have all of STL covered and more.
recursive将近 9 年前
I&#x27;m curious how array slicing is any different from ArraySegment&lt;T&gt;, which is very old.
评论 #11962264 未加载
rco8786将近 9 年前
C# is basically becoming Scala
评论 #11963545 未加载