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. The Lounge
  3. It's not often I find a truly interesting blog post on C#...

It's not often I find a truly interesting blog post on C#...

Scheduled Pinned Locked Moved The Lounge
csharpcomhelptutorial
13 Posts 10 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 musefan

    Of course it's documented! It's documented right there in that blog post you just read! :laugh:

    Greg UtasG Offline
    Greg UtasG Offline
    Greg Utas
    wrote on last edited by
    #4

    The author does actually suggest linking to his blog if your co-workers don't understand your code when it uses one of these spiffy features! :laugh:

    Robust Services Core | Software Techniques for Lemmings | Articles

    <p><a href="https://github.com/GregUtas/robust-services-core/blob/master/README.md">Robust Services Core</a>
    <em>The fox knows many things, but the hedgehog knows one big thing.</em></p>

    1 Reply Last reply
    0
    • M Marc Clifton

      This: The Magical Methods in C# · Cezary Piątek Blog[^] is an exception.

      Quote:

      There’s a certain set of special method signatures in C# which have particular support on the language level. Methods with those signatures allow for using a special syntax which has several benefits. For example, we can use them to simplify our code or create DSL to express a solution to our domain-specific problem in a much cleaner way. I came across those methods in different places, so I decided to create a blog post to summarize all my discoveries on this subject.

      Very cool.

      Latest Articles:
      Abusing Extension Methods, Null Continuation, and Null Coalescence Operators

      honey the codewitchH Offline
      honey the codewitchH Offline
      honey the codewitch
      wrote on last edited by
      #5

      Nice. I love it when I learn stuff.

      Real programmers use butterflies

      M 1 Reply Last reply
      0
      • honey the codewitchH honey the codewitch

        Nice. I love it when I learn stuff.

        Real programmers use butterflies

        M Offline
        M Offline
        Marc Clifton
        wrote on last edited by
        #6

        honey the codewitch wrote:

        Nice. I love it when I learn stuff.

        I thought you might find that interesting. And yes, agreed! Learned new stuff!

        Latest Articles:
        Abusing Extension Methods, Null Continuation, and Null Coalescence Operators

        1 Reply Last reply
        0
        • M Marc Clifton

          This: The Magical Methods in C# · Cezary Piątek Blog[^] is an exception.

          Quote:

          There’s a certain set of special method signatures in C# which have particular support on the language level. Methods with those signatures allow for using a special syntax which has several benefits. For example, we can use them to simplify our code or create DSL to express a solution to our domain-specific problem in a much cleaner way. I came across those methods in different places, so I decided to create a blog post to summarize all my discoveries on this subject.

          Very cool.

          Latest Articles:
          Abusing Extension Methods, Null Continuation, and Null Coalescence Operators

          O Offline
          O Offline
          obermd
          wrote on last edited by
          #7

          Every single one of those "tricks" is documented in the C# online documentation. This is simply someone who didn't bother to read the C# language documentation. Not impressed.

          1 Reply Last reply
          0
          • M Marc Clifton

            This: The Magical Methods in C# · Cezary Piątek Blog[^] is an exception.

            Quote:

            There’s a certain set of special method signatures in C# which have particular support on the language level. Methods with those signatures allow for using a special syntax which has several benefits. For example, we can use them to simplify our code or create DSL to express a solution to our domain-specific problem in a much cleaner way. I came across those methods in different places, so I decided to create a blog post to summarize all my discoveries on this subject.

            Very cool.

            Latest Articles:
            Abusing Extension Methods, Null Continuation, and Null Coalescence Operators

            B Offline
            B Offline
            BillWoodruff
            wrote on last edited by
            #8

            :thumbsup:

                    var errorCodes = new Dictionary
                    {
                        \[404\] = "Page not Found",
                        \[302\] = "Page moved, but left a forwarding address.",
                        \[500\] = "The web server can't come out to play today."
                    };
            

            that got my attention !

            «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

            O 1 Reply Last reply
            0
            • B BillWoodruff

              :thumbsup:

                      var errorCodes = new Dictionary
                      {
                          \[404\] = "Page not Found",
                          \[302\] = "Page moved, but left a forwarding address.",
                          \[500\] = "The web server can't come out to play today."
                      };
              

              that got my attention !

              «One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

              O Offline
              O Offline
              obermd
              wrote on last edited by
              #9

              BillWoodruff wrote:

              var errorCodes = new Dictionary<int, string> { [404] = "Page not Found", [302] = "Page moved, but left a forwarding address.", [500] = "The web server can't come out to play today." };

              It's a syntactic side effect of the Add and Item methods. If you set a value of a dictionary via the Item method and the key doesn't exist the class will add the key and value. It is a very nice and clean way of writing:

              var errorCodes = new Dictionary
              {
              {[404], "Page not Found"},
              {[302], "Page moved, but left a forwarding address."},
              {[500], "The web server can't come out to play today."}
              };

              As I stated previously, there is nothing in this guy's blog that isn't directly the result of the C# and dotNet framework class documentation.

              S 1 Reply Last reply
              0
              • O obermd

                BillWoodruff wrote:

                var errorCodes = new Dictionary<int, string> { [404] = "Page not Found", [302] = "Page moved, but left a forwarding address.", [500] = "The web server can't come out to play today." };

                It's a syntactic side effect of the Add and Item methods. If you set a value of a dictionary via the Item method and the key doesn't exist the class will add the key and value. It is a very nice and clean way of writing:

                var errorCodes = new Dictionary
                {
                {[404], "Page not Found"},
                {[302], "Page moved, but left a forwarding address."},
                {[500], "The web server can't come out to play today."}
                };

                As I stated previously, there is nothing in this guy's blog that isn't directly the result of the C# and dotNet framework class documentation.

                S Offline
                S Offline
                Sasa Cetkovic
                wrote on last edited by
                #10

                Who reads the entire documentation?

                K 1 Reply Last reply
                0
                • S Sasa Cetkovic

                  Who reads the entire documentation?

                  K Offline
                  K Offline
                  kalberts
                  wrote on last edited by
                  #11

                  I think we have bots for that :-)

                  1 Reply Last reply
                  0
                  • M Marc Clifton

                    This: The Magical Methods in C# · Cezary Piątek Blog[^] is an exception.

                    Quote:

                    There’s a certain set of special method signatures in C# which have particular support on the language level. Methods with those signatures allow for using a special syntax which has several benefits. For example, we can use them to simplify our code or create DSL to express a solution to our domain-specific problem in a much cleaner way. I came across those methods in different places, so I decided to create a blog post to summarize all my discoveries on this subject.

                    Very cool.

                    Latest Articles:
                    Abusing Extension Methods, Null Continuation, and Null Coalescence Operators

                    J Offline
                    J Offline
                    James Curran
                    wrote on last edited by
                    #12

                    He hints at it but doesn't show what you can do with the LINQ pattern. You can do fun stuff like this:

                    void Main()
                    {
                    var notACollection = new MyClass();
                    var x = from a in notACollection
                    where a.DoesntMatter == 5
                    select "Greetings Earthling";

                    	x.Dump();       // Prints "HELLO, WORLD!"
                    	
                    }
                    
                    class MyClass
                        {
                    	string \_msg;
                    	public int DoesntMatter;
                    	
                    	public MyClass Where(Func \_)
                    	{
                    		\_msg = "Hello, World!";
                    		return this;
                    	}
                    
                    
                    	public string Select(Func \_)
                    	{
                    		return \_msg.ToUpperInvariant();
                    	}
                    }
                    

                    Truth, James

                    1 Reply Last reply
                    0
                    • M Marc Clifton

                      This: The Magical Methods in C# · Cezary Piątek Blog[^] is an exception.

                      Quote:

                      There’s a certain set of special method signatures in C# which have particular support on the language level. Methods with those signatures allow for using a special syntax which has several benefits. For example, we can use them to simplify our code or create DSL to express a solution to our domain-specific problem in a much cleaner way. I came across those methods in different places, so I decided to create a blog post to summarize all my discoveries on this subject.

                      Very cool.

                      Latest Articles:
                      Abusing Extension Methods, Null Continuation, and Null Coalescence Operators

                      T Offline
                      T Offline
                      Thornik
                      wrote on last edited by
                      #13

                      Literally only this one article worth to read. Everything else in this so called "blog" just a water.

                      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