Essential C# 6 Features You Need to Know!
-
Does anyone find "using static" to be helpful? If yes then in what circumstances? I just can't find any reason to use it... even in that very common example ("using static System.Console", which everyone that has posted a C# 6 feature used, I find it's much worse to read it in this manner. There are some nice features, like Auto-Property initializers it could be helpful for creating a readonly properties, but the only extremely helpful thing (at least to me) is the introduction of nameOf...
-
I can´t imagine using it for Console.WriteLine or something, but I think importing extension methods from a class instead of a namespace makes much more sense. Like: using static System.Linq.Enumerable;
-
That's dreadful. X|
PIEBALDconsult wrote:
That's dreadful. X|
The feature, or the sample? :D
-
PIEBALDconsult wrote:
That's dreadful. X|
The feature, or the sample? :D
Yes.
-
I can´t imagine using it for Console.WriteLine or something, but I think importing extension methods from a class instead of a namespace makes much more sense. Like: using static System.Linq.Enumerable;
That's why I separate each of my Extension Methods (with overloads) into its own namespace -- I really can't stand having a whole load of crap brought in when I want only one small piece of crap. But then I also don't like the implementation of Extension Methods requiring the
using
directive, and the C# implementation not directly using the Attribute (unlike VB.net). X| -
I see what you mean, so for example if we have one large Extensions namespace with this we could clarify or emphasise exactly which extensions we are using. Well that could be helpful. Thanks for the reply.
Only as far as the developer allows.
-
That's why I separate each of my Extension Methods (with overloads) into its own namespace -- I really can't stand having a whole load of crap brought in when I want only one small piece of crap. But then I also don't like the implementation of Extension Methods requiring the
using
directive, and the C# implementation not directly using the Attribute (unlike VB.net). X| -
Telerik wrote:
Let’s jump in.
No, let's not.
-
Rob Grainger wrote:
If that continues, we may end up with something as unreadable as Perl.
:laugh: I hate Perl with a vengeance!
Kevin
Kevin McFarlane wrote:
Perl with a vengeance
Isn't that Perl 6? :-D
-
With the final version of C# 6 having been released, we can seen that a lot of syntax changes have occurred since its inception. Because of this, I’ve noticed that most of the blog posts currently on the internet don’t work anymore or are too vague about how they implemented a feature. I thought it would be useful to make a list of the most essential C# 6 features with simple code examples that would make it both easy to understand and simple to copy/paste a sample into a new console app to try it. Let’s jump in.
Don't you feel smarter now?
I used several of this. Then was told my applet had to run on .NET 4.5.1 and had to take them out.
-
I used several of this. Then was told my applet had to run on .NET 4.5.1 and had to take them out.
Most of them are compiler features. So long as you're compiling in VS2015, they should still work even if you're targeting an earlier version of the framework.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Most of them are compiler features. So long as you're compiling in VS2015, they should still work even if you're targeting an earlier version of the framework.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Should and do are two different things.