TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

.NET Framework – What's New in C# 7.0

234 pointsby kukxover 8 years ago

19 comments

zilchersover 8 years ago
Is it just me, or is C# basically becoming Scala (or, insert your favorite functional language here). Don't get me wrong, this is awesome, .net on Linux, dockerized, is all good, but these moves definitely show Microsoft responding to market changes in a way they didn't used to.
评论 #12972763 未加载
评论 #12973740 未加载
评论 #12976116 未加载
评论 #12973372 未加载
评论 #12974263 未加载
评论 #12974924 未加载
评论 #12973648 未加载
评论 #12973449 未加载
评论 #12973191 未加载
louthyover 8 years ago
Throw expressions are particularly welcome. I&#x27;d previously dealt with that issue by creating a static method that returned the expected type, but just threw an exception [1][2]<p>I&#x27;m not sure it&#x27;s explicit in the blog, but it seems the deconstructor will be useful for pattern-matching using &#x27;is&#x27;.<p>Tuples. Yay! Finally!<p>Pattern-matching-switch-statement: Not an expression. That&#x27;s a bad call. We have expression based ternary, throws, method bodies, and LINQ; switches are the last and most painful omission.<p>Local functions: Fantastic for libraries like mine, which is trying to bring functional programming to the C# world, but takes a hit with the allocation of delegates for common operations [3] It should be a boon for anything LINQ based (implementations, rather than usage).<p>Return by ref and out parameters: I&#x27;d be happy if they just removed them from the language. Ugly, error magnets.<p>All in all, good progress. Hopefully they can make more progress on facilitating expression-based programming, and bring in record types for the next release. The pain of creating immutable types is truly tedious. And I&#x27;d desperately like to see partial generic parameter specifying (for when one of the generic arguments can&#x27;t be inferred by the type-system, so you then end up having to specify them all).<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;louthy&#x2F;language-ext&#x2F;blob&#x2F;master&#x2F;LanguageExt.Core&#x2F;Prelude.cs#L209" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;louthy&#x2F;language-ext&#x2F;blob&#x2F;master&#x2F;LanguageE...</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;louthy&#x2F;language-ext&#x2F;blob&#x2F;master&#x2F;LanguageExt.Core&#x2F;Prelude.cs#L182" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;louthy&#x2F;language-ext&#x2F;blob&#x2F;master&#x2F;LanguageE...</a><p>[3] <a href="https:&#x2F;&#x2F;github.com&#x2F;louthy&#x2F;language-ext&#x2F;blob&#x2F;type-classes&#x2F;LanguageExt.Core&#x2F;TypeClasses&#x2F;Monad&#x2F;Monad.Prelude.cs#L70" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;louthy&#x2F;language-ext&#x2F;blob&#x2F;type-classes&#x2F;Lan...</a>
评论 #12972634 未加载
评论 #12974864 未加载
评论 #12974497 未加载
batinaover 8 years ago
Pattern Matching with Is Expressions<p>Awesome! Greatly reduces &quot;ugly&quot; boilerplate code like this:<p><pre><code> if (control is TextBox) { var textBox = (TextBox)control; textBox... } </code></pre> Also, it would be great if Microsoft could make full properties in another way so that you do not have to write a backing field for it. Something like this:<p><pre><code> public string LastName { get; set { if (value == &quot;Batina&quot;) RaisePropertyChanged(); } } </code></pre> It would make code more cleaner.
评论 #12976424 未加载
评论 #12975918 未加载
netcraftover 8 years ago
So, lets say someone had never worked with C# or .net before and works on a mac - where would you go to get started building a small server application? I assume you would use the .net core stuff? and visual studio code? Any good tutorials for noob-to-the-ecosystem but someone that has programming experience?
评论 #12972175 未加载
评论 #12972190 未加载
评论 #12972139 未加载
评论 #12976102 未加载
评论 #12972165 未加载
JamesBarneyover 8 years ago
Kinda surprised me Microsoft doesn&#x27;t have better syntax highlighting on msdn.<p>The lack of coloration and gray background gave me a little bit of a headache.
评论 #12972517 未加载
评论 #12975341 未加载
评论 #12976823 未加载
评论 #12972503 未加载
评论 #12972672 未加载
zamalekover 8 years ago
I&#x27;m very disappointed that ref returns were not implemented as syntactic sugar for out params.<p>A bit of history: game developers have been crying for a solution to the matrix operator problem. A 4x4 matrix is 64 bytes of data. Implement the mathematical operators using C# operators and you&#x27;re looking at 192 bytes copied per invocation. The workaround is the fake ref operator: void Add(ref Matrix, ref Matrix, out Matrix). The problem is that this results in code smell at the call sites. The ref return was the first compromise, allowing that method to become: ref Matrix Add(...). The ultimate solution would be to allow ref returns and ref parameters on operators, but you need ref returns first.<p>This feature misses all of that. Maybe we&#x27;ll get out returns, but the argument against it would be language bloat, and even I&#x27;d agree. <i>Sigh.</i><p>&#x2F;rant
评论 #12976210 未加载
评论 #12975807 未加载
评论 #12988983 未加载
markatkinsonover 8 years ago
It puts a smile on my beak that I am a budding (sort of) .Net and C# developer. Microsoft seems to be really jacked up and introducing some very forward thinking functionality into their ecosystem. Been playing with Azure Service Fabric. It is super impressive.
评论 #12976165 未加载
setqover 8 years ago
I&#x27;m interested to see what the production story is for some of these language features. I usually get left a festering minidump with a number of threads, a pile of stacks and some line numbers if I&#x27;m lucky these days. It&#x27;s quite hard determining which dereference or call is the one that triggered the problem in a method body with so many things now compacted into a tight expression.<p>Granted there should be assertions to prevent these conditions occurring but not everyone on the team is perfect 100% of the time. Sometimes an edge case slides in as well and you have to heavily assert everything and push to test&#x2F;production to reproduce which isn&#x27;t ideal.
alexroover 8 years ago
Are we back to the 90-ties with no code highlights in text?
评论 #12972363 未加载
评论 #12972669 未加载
redwards510over 8 years ago
Can someone give an example of a use case for a Deconstructor?
评论 #12972487 未加载
评论 #12980958 未加载
评论 #12972485 未加载
评论 #12976761 未加载
keithnzover 8 years ago
more improvements that allows more concise code and that looks functional in nature. Which is great, I have to do a lot in C# and really like it as a OO &#x2F; with functional abilities type language.<p>But I keep wondering why F# doesn&#x27;t really take off given a lot of peoples fascination with the functional world. It does functional nicely while still being able to bridge back to the OO world which allows you to easily leverage a <i></i>LARGE<i></i> amount of libraries in the .net world. It has a really good community, and F# specific frameworks for various things as well. It&#x27;s like a hidden gem that people pass over as they look at functional languages with much much smaller ecosystems.
评论 #12976734 未加载
评论 #12977021 未加载
jdmichalover 8 years ago
I&#x27;m a little disappointed that pattern matching doesn&#x27;t simply narrow the variable, and instead requires a new variable name to hold the narrowed type. Even TypeScript narrows the variable in-place!
评论 #12973005 未加载
评论 #12973847 未加载
评论 #12974412 未加载
muterad_murilaxover 8 years ago
Minor nitpick: the title is (edit: was) missing a leading dot.
duke360over 8 years ago
major part of these new features are very cool but i&#x27;m afraid they could compromise future evolution of the Language. some implementation details scares me, maybe i&#x27;ll become used to them, i only hope that these doesn&#x27;t result in a boomerang for future versions.<p>Deconstruction implementation is scary, i would prefer to have a special symbol (like the desctrutor) and duples that ignores names are ok but sounds very error prone, maybe i just have to try them to understand, also order sensitive case makes my dev sense tingle...
gigatexalover 8 years ago
I was a die-hard python guy and now I&#x27;m a die-hard python guy who appreciates .Net. (Forced to because I work in a .Net shop, but it has chops)
bobcostas55over 8 years ago
Why such a verbose syntax for pattern matching?
评论 #12976899 未加载
ryenusover 8 years ago
Possible to use variable placeholders on the left side of a deconstructor assignment?
评论 #12975426 未加载
stuartdover 8 years ago
&#x27;goto case&#x27; is a thing? I&#x27;m so going to have fun with that
评论 #12975920 未加载
shaydocover 8 years ago
removal of pre-declaration of out parameters = win!