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. C# 8: Default interface methods implementation

C# 8: Default interface methods implementation

Scheduled Pinned Locked Moved The Insider News
csharpquestion
5 Posts 5 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.
  • K Offline
    K Offline
    Kent Sharkey
    wrote on last edited by
    #1

    Code Journey[^]:

    Today we are taking a look at a bit controversial one. It’s a possibility to provide default interface methods implementation.

    So... a base class?

    Richard DeemingR realJSOPR W B 4 Replies Last reply
    0
    • K Kent Sharkey

      Code Journey[^]:

      Today we are taking a look at a bit controversial one. It’s a possibility to provide default interface methods implementation.

      So... a base class?

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

      Quote:

      ... this feature will not work with .NET Framework! Only CoreCLR and Mono stack runtimes are going to receive these new updates.

      Possibly the most important line from the article. It's not yet clear whether this will be added to a future version of dNF, or whether dNF is now in "maintenance mode" and everyone's being dragged kicking and screaming nudged towards CoreCLR.


      "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

      1 Reply Last reply
      0
      • K Kent Sharkey

        Code Journey[^]:

        Today we are taking a look at a bit controversial one. It’s a possibility to provide default interface methods implementation.

        So... a base class?

        realJSOPR Offline
        realJSOPR Offline
        realJSOP
        wrote on last edited by
        #3

        What a PFF (pointless f*ckin feature). Like you said... base class. Another (better) solution is to simply create another interface that ionherits the old interface:

        // original interface that a lot of classes use
        public interface IOne
        {
        void Method1();
        }

        // addition methods that enhance IOne's interfacinality
        public interface ITwo : IOne
        {
        void Method2();
        }

        // derives from old IOne interface and keeps on working
        public class OldClass : IOne
        {
        public void Method1() {}
        }

        // The programmer is ready to implement the new method in his class, so
        // he simply inherits ITwo (which inherits from IOne)
        public class MyClass : ITwo
        {
        public void Method1() {}
        public void Method2() {}
        }

        The dowwnstream classes can be modified as needed. There's absolutely no need for this kinda crap/fluff. Let core keep that crap.

        ".45 ACP - because shooting twice is just silly" - JSOP, 2010
        -----
        You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
        -----
        When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

        1 Reply Last reply
        0
        • K Kent Sharkey

          Code Journey[^]:

          Today we are taking a look at a bit controversial one. It’s a possibility to provide default interface methods implementation.

          So... a base class?

          W Offline
          W Offline
          WaferFun
          wrote on last edited by
          #4

          Do that means we finially have somthing similiar to multiple inheritance in C#? or just the con side of it?

          1 Reply Last reply
          0
          • K Kent Sharkey

            Code Journey[^]:

            Today we are taking a look at a bit controversial one. It’s a possibility to provide default interface methods implementation.

            So... a base class?

            B Offline
            B Offline
            Bernhard Hiller
            wrote on last edited by
            #5

            Isn't that an old Java feature?

            Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!

            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