Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Insider News
  4. Essential C# 6 Features You Need to Know!

Essential C# 6 Features You Need to Know!

Scheduled Pinned Locked Moved The Insider News
csharpcomquestionannouncement
27 Posts 15 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Mario Z

    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...

    D Offline
    D Offline
    Dennis_E
    wrote on last edited by
    #16

    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;

    M P 2 Replies Last reply
    0
    • D Dennis_E

      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;

      M Offline
      M Offline
      Mario Z
      wrote on last edited by
      #17

      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.

      P 1 Reply Last reply
      0
      • P PIEBALDconsult

        That's dreadful. X|

        F Offline
        F Offline
        FIorian Schneidereit
        wrote on last edited by
        #18

        PIEBALDconsult wrote:

        That's dreadful. X|

        The feature, or the sample? :D

        P 1 Reply Last reply
        0
        • F FIorian Schneidereit

          PIEBALDconsult wrote:

          That's dreadful. X|

          The feature, or the sample? :D

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #19

          Yes.

          1 Reply Last reply
          0
          • D Dennis_E

            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;

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #20

            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|

            M 1 Reply Last reply
            0
            • M Mario Z

              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.

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #21

              Only as far as the developer allows.

              1 Reply Last reply
              0
              • P PIEBALDconsult

                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|

                M Offline
                M Offline
                Mario Z
                wrote on last edited by
                #22

                I also keep them in separate namespaces, it's much cleaner. But nevertheless I do recall seeing some huge extension containers and I presume this could arrange a bit those big piles of mess...

                1 Reply Last reply
                0
                • P PIEBALDconsult

                  Telerik wrote:

                  Let’s jump in.

                  No, let's not.

                  P Offline
                  P Offline
                  Patrice T
                  wrote on last edited by
                  #23

                  :thumbsup::thumbsup: ;P ;P

                  Patrice “Everything should be made as simple as possible, but no simpler.” Albert Einstein

                  1 Reply Last reply
                  0
                  • K Kevin McFarlane

                    Rob Grainger wrote:

                    If that continues, we may end up with something as unreadable as Perl.

                    :laugh: I hate Perl with a vengeance!

                    Kevin

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #24

                    Kevin McFarlane wrote:

                    Perl with a vengeance

                    Isn't that Perl 6? :-D

                    1 Reply Last reply
                    0
                    • K Kevin Priddle

                      Telerik[^]:

                      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?

                      J Offline
                      J Offline
                      Joe Woodbury
                      wrote on last edited by
                      #25

                      I used several of this. Then was told my applet had to run on .NET 4.5.1 and had to take them out.

                      Richard DeemingR 1 Reply Last reply
                      0
                      • J Joe Woodbury

                        I used several of this. Then was told my applet had to run on .NET 4.5.1 and had to take them out.

                        Richard DeemingR Offline
                        Richard DeemingR Offline
                        Richard Deeming
                        wrote on last edited by
                        #26

                        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

                        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                        J 1 Reply Last reply
                        0
                        • Richard DeemingR Richard Deeming

                          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

                          J Offline
                          J Offline
                          Joe Woodbury
                          wrote on last edited by
                          #27

                          Should and do are two different things.

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups