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

PSOTWIFLI

Scheduled Pinned Locked Moved The Lounge
csharppythoncssvisual-studiocom
41 Posts 22 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 Offline
    M Offline
    Marc Clifton
    wrote on last edited by
    #1

    (Programming Survey Of The Whenever I Feel Like It) Example (example only, don't ask what or why):

    Processing.Fire(this, new ProcessEventArgs()
    {
    FromMembrane = fromMembrane,
    FromReceptor = fromReceptor,
    ToMembrane = membrane,
    ToReceptor = target,
    SemanticType = obj
    });

    vs.

    Processing.Fire(this, new ProcessEventArgs(fromMembrane, fromReceptor, membrane, target, obj));

    Which form do you prefer? Why? The former form from :) which I observe my style seems to be the preferable format. Not sure why though.

    Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

    M L J S G 22 Replies Last reply
    0
    • M Marc Clifton

      (Programming Survey Of The Whenever I Feel Like It) Example (example only, don't ask what or why):

      Processing.Fire(this, new ProcessEventArgs()
      {
      FromMembrane = fromMembrane,
      FromReceptor = fromReceptor,
      ToMembrane = membrane,
      ToReceptor = target,
      SemanticType = obj
      });

      vs.

      Processing.Fire(this, new ProcessEventArgs(fromMembrane, fromReceptor, membrane, target, obj));

      Which form do you prefer? Why? The former form from :) which I observe my style seems to be the preferable format. Not sure why though.

      Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

      M Offline
      M Offline
      megaadam
      wrote on last edited by
      #2

      A. Explicit params are good vs implicit [by position] but your symbol names take me to... [youtu.be/zAlNrtcPCLw](https://youtu.be/zAlNrtcPCLw) one of the most annoying songs in recent history

      ... such stuff as dreams are made on

      M 1 Reply Last reply
      0
      • M Marc Clifton

        (Programming Survey Of The Whenever I Feel Like It) Example (example only, don't ask what or why):

        Processing.Fire(this, new ProcessEventArgs()
        {
        FromMembrane = fromMembrane,
        FromReceptor = fromReceptor,
        ToMembrane = membrane,
        ToReceptor = target,
        SemanticType = obj
        });

        vs.

        Processing.Fire(this, new ProcessEventArgs(fromMembrane, fromReceptor, membrane, target, obj));

        Which form do you prefer? Why? The former form from :) which I observe my style seems to be the preferable format. Not sure why though.

        Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        because the second wont compile? (missing close bracket)

        Installing Signature... Do not switch off your computer.

        M 1 Reply Last reply
        0
        • M Marc Clifton

          (Programming Survey Of The Whenever I Feel Like It) Example (example only, don't ask what or why):

          Processing.Fire(this, new ProcessEventArgs()
          {
          FromMembrane = fromMembrane,
          FromReceptor = fromReceptor,
          ToMembrane = membrane,
          ToReceptor = target,
          SemanticType = obj
          });

          vs.

          Processing.Fire(this, new ProcessEventArgs(fromMembrane, fromReceptor, membrane, target, obj));

          Which form do you prefer? Why? The former form from :) which I observe my style seems to be the preferable format. Not sure why though.

          Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

          J Offline
          J Offline
          Jim_Snyder
          wrote on last edited by
          #4

          I would like the bottom form if the number of parentheses matched. The top form is more difficult to match up what belongs with what. My real preference would be: ``` Processing.Fire ( this, new ProcessEventArgs() { fromMembrane, fromReceptor, membrane, target, obj } ) ```

          M 1 Reply Last reply
          0
          • M Marc Clifton

            (Programming Survey Of The Whenever I Feel Like It) Example (example only, don't ask what or why):

            Processing.Fire(this, new ProcessEventArgs()
            {
            FromMembrane = fromMembrane,
            FromReceptor = fromReceptor,
            ToMembrane = membrane,
            ToReceptor = target,
            SemanticType = obj
            });

            vs.

            Processing.Fire(this, new ProcessEventArgs(fromMembrane, fromReceptor, membrane, target, obj));

            Which form do you prefer? Why? The former form from :) which I observe my style seems to be the preferable format. Not sure why though.

            Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

            S Offline
            S Offline
            Sascha Lefevre
            wrote on last edited by
            #5

            Depends - if I can reasonably name the variables "almost like" the argument names (e.g. "targetReceptor" instead of "target") and if I have no reason to use an expression as parameter then I go for the second form because I don't feel the first form would increase the clarity of the code.

            If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

            1 Reply Last reply
            0
            • M Marc Clifton

              (Programming Survey Of The Whenever I Feel Like It) Example (example only, don't ask what or why):

              Processing.Fire(this, new ProcessEventArgs()
              {
              FromMembrane = fromMembrane,
              FromReceptor = fromReceptor,
              ToMembrane = membrane,
              ToReceptor = target,
              SemanticType = obj
              });

              vs.

              Processing.Fire(this, new ProcessEventArgs(fromMembrane, fromReceptor, membrane, target, obj));

              Which form do you prefer? Why? The former form from :) which I observe my style seems to be the preferable format. Not sure why though.

              Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

              G Offline
              G Offline
              GuyThiebaut
              wrote on last edited by
              #6

              The first sort of feels clunky but it is much safer. Someone will one day insert a field in the middle of the others and the thing will go kaboom(I hope I am not being too technical in my language here).

              “That which can be asserted without evidence, can be dismissed without evidence.”

              ― Christopher Hitchens

              M J 2 Replies Last reply
              0
              • L Lost User

                because the second wont compile? (missing close bracket)

                Installing Signature... Do not switch off your computer.

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

                Lopatir wrote:

                because the second wont compile? (missing close bracket)

                :rolleyes: Fixed. The second one was hand-written rather than from a working example. :)

                Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                1 Reply Last reply
                0
                • M megaadam

                  A. Explicit params are good vs implicit [by position] but your symbol names take me to... [youtu.be/zAlNrtcPCLw](https://youtu.be/zAlNrtcPCLw) one of the most annoying songs in recent history

                  ... such stuff as dreams are made on

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

                  megaadam wrote:

                  one of the most annoying songs in recent history

                  OK, back to [Schiller](https://www.youtube.com/watch?v=yrZa9LDrMPY&t=1013s) for me! I take it you've not read [The Clifton Method - Part IV](https://www.codeproject.com/Articles/1120520/The-Clifton-Method-Part-IV) :rolleyes:

                  Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                  1 Reply Last reply
                  0
                  • J Jim_Snyder

                    I would like the bottom form if the number of parentheses matched. The top form is more difficult to match up what belongs with what. My real preference would be: ``` Processing.Fire ( this, new ProcessEventArgs() { fromMembrane, fromReceptor, membrane, target, obj } ) ```

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

                    Jim_Snyder wrote:

                    I would like the bottom form if the number of parentheses matched.

                    Wow, people's eyes are good. Fixed, but still inline. But I like your version.

                    Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                    J 1 Reply Last reply
                    0
                    • G GuyThiebaut

                      The first sort of feels clunky but it is much safer. Someone will one day insert a field in the middle of the others and the thing will go kaboom(I hope I am not being too technical in my language here).

                      “That which can be asserted without evidence, can be dismissed without evidence.”

                      ― Christopher Hitchens

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

                      GuyThiebaut wrote:

                      insert a field in the middle of the others and the thing will go kaboom

                      Good point. :)

                      Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                      1 Reply Last reply
                      0
                      • M Marc Clifton

                        Jim_Snyder wrote:

                        I would like the bottom form if the number of parentheses matched.

                        Wow, people's eyes are good. Fixed, but still inline. But I like your version.

                        Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                        J Offline
                        J Offline
                        Jim_Snyder
                        wrote on last edited by
                        #11

                        For some Markdown Formatting reason, I cannot get ``Processing.Fire`` to display in the block.

                        M 1 Reply Last reply
                        0
                        • M Marc Clifton

                          (Programming Survey Of The Whenever I Feel Like It) Example (example only, don't ask what or why):

                          Processing.Fire(this, new ProcessEventArgs()
                          {
                          FromMembrane = fromMembrane,
                          FromReceptor = fromReceptor,
                          ToMembrane = membrane,
                          ToReceptor = target,
                          SemanticType = obj
                          });

                          vs.

                          Processing.Fire(this, new ProcessEventArgs(fromMembrane, fromReceptor, membrane, target, obj));

                          Which form do you prefer? Why? The former form from :) which I observe my style seems to be the preferable format. Not sure why though.

                          Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

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

                          As always, the only valid answer is: it depends. :) Does it make sense for the properties to be writeable? Particularly in an EventArgs class, where you probably don't want one rogue handler to change the data that other handlers see. If you have lots of parameters, and you don't always need to pass all of them, an object initializer might be cleaner. But you could do something similar with optional parameters, or provide constructor overloads for each valid set of parameters. And if you're in that situation, it might be time to refactor the class anyway, because it's probably breaking the SRP.


                          "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

                          M 1 Reply Last reply
                          0
                          • G GuyThiebaut

                            The first sort of feels clunky but it is much safer. Someone will one day insert a field in the middle of the others and the thing will go kaboom(I hope I am not being too technical in my language here).

                            “That which can be asserted without evidence, can be dismissed without evidence.”

                            ― Christopher Hitchens

                            J Offline
                            J Offline
                            Jim_Snyder
                            wrote on last edited by
                            #13

                            The *nerve* of some folks!

                            1 Reply Last reply
                            0
                            • Richard DeemingR Richard Deeming

                              As always, the only valid answer is: it depends. :) Does it make sense for the properties to be writeable? Particularly in an EventArgs class, where you probably don't want one rogue handler to change the data that other handlers see. If you have lots of parameters, and you don't always need to pass all of them, an object initializer might be cleaner. But you could do something similar with optional parameters, or provide constructor overloads for each valid set of parameters. And if you're in that situation, it might be time to refactor the class anyway, because it's probably breaking the SRP.


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

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

                              Richard Deeming wrote:

                              Does it make sense for the properties to be writeable?

                              5! Yes, that's the hidden "gotcha". When using a constructor, the class can be initialized like this:

                              public class ProcessEventArgs : EventArgs
                              {
                              public IMembrane FromMembrane { get; protected set; }
                              public IReceptor FromReceptor { get; protected set; }
                              public IMembrane ToMembrane { get; protected set; }
                              public IReceptor ToReceptor { get; protected set; }
                              public ISemanticType SemanticType { get; protected set; }

                              public ProcessEventArgs(IMembrane fromMembrane, IReceptor fromReceptor, IMembrane toMembrane, IReceptor toReceptor, ISemanticType st)
                              {
                              FromMembrane = fromMembrane;
                              FromReceptor = fromReceptor;
                              ToMembrane = toMembrane;
                              ToReceptor = toReceptor;
                              SemanticType = st;
                              }
                              }

                              Note the protected setters. :)

                              Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                              Richard DeemingR 1 Reply Last reply
                              0
                              • J Jim_Snyder

                                For some Markdown Formatting reason, I cannot get ``Processing.Fire`` to display in the block.

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

                                Jim_Snyder wrote:

                                For some Markdown Formatting reason, I cannot get Processing.Fire to display in the block.

                                Bizarre. Works for me! :-D [edit] Oh, in you're example. Yeah, I was wondering about that. [/edit]

                                Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                                1 Reply Last reply
                                0
                                • M Marc Clifton

                                  (Programming Survey Of The Whenever I Feel Like It) Example (example only, don't ask what or why):

                                  Processing.Fire(this, new ProcessEventArgs()
                                  {
                                  FromMembrane = fromMembrane,
                                  FromReceptor = fromReceptor,
                                  ToMembrane = membrane,
                                  ToReceptor = target,
                                  SemanticType = obj
                                  });

                                  vs.

                                  Processing.Fire(this, new ProcessEventArgs(fromMembrane, fromReceptor, membrane, target, obj));

                                  Which form do you prefer? Why? The former form from :) which I observe my style seems to be the preferable format. Not sure why though.

                                  Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                                  P Offline
                                  P Offline
                                  Pete OHanlon
                                  wrote on last edited by
                                  #16

                                  The answer, of course, is that it all depends. The second example has the potential to introduce errors that the first doesn't if you're looking at validation to make sure that the values in ProcessEventArgs aren't null (validating them in the constructor of course). More importantly, the second example implies that you have opened up the scope of the properties to be read/write as opposed to read only. It really depends on what the use case is for ProcessEventArgs.

                                  This space for rent

                                  M 1 Reply Last reply
                                  0
                                  • M Marc Clifton

                                    (Programming Survey Of The Whenever I Feel Like It) Example (example only, don't ask what or why):

                                    Processing.Fire(this, new ProcessEventArgs()
                                    {
                                    FromMembrane = fromMembrane,
                                    FromReceptor = fromReceptor,
                                    ToMembrane = membrane,
                                    ToReceptor = target,
                                    SemanticType = obj
                                    });

                                    vs.

                                    Processing.Fire(this, new ProcessEventArgs(fromMembrane, fromReceptor, membrane, target, obj));

                                    Which form do you prefer? Why? The former form from :) which I observe my style seems to be the preferable format. Not sure why though.

                                    Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                                    J Offline
                                    J Offline
                                    Johnny J
                                    wrote on last edited by
                                    #17

                                    I'm old school, so the second one any day! :thumbsup:

                                    Anything that is unrelated to elephants is irrelephant
                                    Anonymous
                                    -----
                                    The problem with quotes on the internet is that you can never tell if they're genuine
                                    Winston Churchill, 1944
                                    -----
                                    I'd just like a chance to prove that money can't make me happy.
                                    Me, all the time

                                    J 1 Reply Last reply
                                    0
                                    • M Marc Clifton

                                      Richard Deeming wrote:

                                      Does it make sense for the properties to be writeable?

                                      5! Yes, that's the hidden "gotcha". When using a constructor, the class can be initialized like this:

                                      public class ProcessEventArgs : EventArgs
                                      {
                                      public IMembrane FromMembrane { get; protected set; }
                                      public IReceptor FromReceptor { get; protected set; }
                                      public IMembrane ToMembrane { get; protected set; }
                                      public IReceptor ToReceptor { get; protected set; }
                                      public ISemanticType SemanticType { get; protected set; }

                                      public ProcessEventArgs(IMembrane fromMembrane, IReceptor fromReceptor, IMembrane toMembrane, IReceptor toReceptor, ISemanticType st)
                                      {
                                      FromMembrane = fromMembrane;
                                      FromReceptor = fromReceptor;
                                      ToMembrane = toMembrane;
                                      ToReceptor = toReceptor;
                                      SemanticType = st;
                                      }
                                      }

                                      Note the protected setters. :)

                                      Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

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

                                      Or better yet, like this:

                                      public class ProcessEventArgs : EventArgs
                                      {
                                      public IMembrane FromMembrane { get; }
                                      public IReceptor FromReceptor { get; }
                                      public IMembrane ToMembrane { get; }
                                      public IReceptor ToReceptor { get; }
                                      public ISemanticType SemanticType { get; }

                                      public ProcessEventArgs(IMembrane fromMembrane, IReceptor fromReceptor, IMembrane toMembrane, IReceptor toReceptor, ISemanticType semanticType)
                                      {
                                      FromMembrane = fromMembrane;
                                      FromReceptor = fromReceptor;
                                      ToMembrane = toMembrane;
                                      ToReceptor = toReceptor;
                                      SemanticType = semanticType;
                                      }
                                      }

                                      (Assuming you're using the C# 6 compiler or later. Otherwise, private set; would have a similar effect.) Also, named parameters can make the constructor look more like the object initializer:

                                      Processing.Fire(this, new ProcessEventArgs(
                                      fromMembrane: fromMembrane,
                                      fromReceptor: fromReceptor,
                                      toMembrane: membrane,
                                      toReceptor: target,
                                      semanticType: obj
                                      ));


                                      "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

                                      M 2 Replies Last reply
                                      0
                                      • M Marc Clifton

                                        (Programming Survey Of The Whenever I Feel Like It) Example (example only, don't ask what or why):

                                        Processing.Fire(this, new ProcessEventArgs()
                                        {
                                        FromMembrane = fromMembrane,
                                        FromReceptor = fromReceptor,
                                        ToMembrane = membrane,
                                        ToReceptor = target,
                                        SemanticType = obj
                                        });

                                        vs.

                                        Processing.Fire(this, new ProcessEventArgs(fromMembrane, fromReceptor, membrane, target, obj));

                                        Which form do you prefer? Why? The former form from :) which I observe my style seems to be the preferable format. Not sure why though.

                                        Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                                        T Offline
                                        T Offline
                                        Tim Carmichael
                                        wrote on last edited by
                                        #19

                                        Arriving late to the party (comments indicate multiple edits have been made). For my older eyes, I prefer the first; I can see what the arguments are on each line without having to scan a list looking for something.

                                        M 1 Reply Last reply
                                        0
                                        • Richard DeemingR Richard Deeming

                                          Or better yet, like this:

                                          public class ProcessEventArgs : EventArgs
                                          {
                                          public IMembrane FromMembrane { get; }
                                          public IReceptor FromReceptor { get; }
                                          public IMembrane ToMembrane { get; }
                                          public IReceptor ToReceptor { get; }
                                          public ISemanticType SemanticType { get; }

                                          public ProcessEventArgs(IMembrane fromMembrane, IReceptor fromReceptor, IMembrane toMembrane, IReceptor toReceptor, ISemanticType semanticType)
                                          {
                                          FromMembrane = fromMembrane;
                                          FromReceptor = fromReceptor;
                                          ToMembrane = toMembrane;
                                          ToReceptor = toReceptor;
                                          SemanticType = semanticType;
                                          }
                                          }

                                          (Assuming you're using the C# 6 compiler or later. Otherwise, private set; would have a similar effect.) Also, named parameters can make the constructor look more like the object initializer:

                                          Processing.Fire(this, new ProcessEventArgs(
                                          fromMembrane: fromMembrane,
                                          fromReceptor: fromReceptor,
                                          toMembrane: membrane,
                                          toReceptor: target,
                                          semanticType: obj
                                          ));


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

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

                                          Richard Deeming wrote:

                                          Also, named parameters can make the constructor look more like the object initializer:

                                          Ah, I've never used that syntax in C#. And yes, omitting the setter or marking it private too. :cool:

                                          Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                                          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