public void Poke()
 {
     AngerLevel++;
     if (AngerLevel >= 3)
     {
         Shout?.Invoke(this, EventArgs.Empty);
     }
 }
Пример #2
0
 // method
 public void poke()
 {
     AngerLevel++;
     if (AngerLevel >= 3)
     {
         // if something is listening...
         Shout?.Invoke(this, EventArgs.Empty);
     }
 }
Пример #3
0
 //method
 public void Poke()
 {
     AngerLevel++;
     if (AngerLevel >= 3)
     {
         // if something is listening, then call the delegate
         Shout?.Invoke(this, EventArgs.Empty);
     }
 }
Пример #4
0
 // method
 public void Poke()
 {
     AngerLevel++;
     if (AngerLevel >= 3)
     {
         // if somebody listens us...
         //... then event raises
         Shout?.Invoke(this, EventArgs.Empty);
     }
 }
Пример #5
0
 // method
 public void Poke()
 {
     AngerLevel++;
     if (AngerLevel >= 3)
     {
         // if something is listening...
         // ...then raise the event
         //?.Invoke check if the event is not null
         Shout?.Invoke(this, EventArgs.Empty);
     }
 }
Пример #6
0
 public void Poked()
 {
     AngerLevel++;
     if (AngerLevel >= 3)
     {
         // if(Shout != null){
         // Shout(this,EventArgs.Empty);
         // }
         Shout?.Invoke(this, EventArgs.Empty);
     }
 }
Пример #7
0
 //method
 public void Poke()
 {
     AngerLevel++;
     if (AngerLevel >= 3)
     {
         //if something is listening..
         // if (Shout != null)
         // {
         //...then call the delegate
         //     Shout(this, EventArgs.Empty);
         // }
         //Below one-liner replaces the above 6 lines. Checking whether an object is null before calling one of its methods is very common. C# 6.0 and later allows the inline null check below.
         Shout?.Invoke(this, EventArgs.Empty);
     }
 }
Пример #8
0
        // method
        public void Poke()
        {
            AngerLevel++;
            if (AngerLevel >= 3)
            {
                // if something is listening

                /*if (Shout != null)
                 * {
                 *  // ...then raise the event
                 *  Shout(this, EventArgs.Empty);
                 * }*/
                Shout?.Invoke(this, EventArgs.Empty);
            }
        }
Пример #9
0
        //method
        public void Poke()
        {
            AngerLevel++;
            if (AngerLevel >= 3)
            {
                // if something is listening
                // then call the delegate

                Shout?.Invoke(this, EventArgs.Empty);

                // if (Shout != null)
                // {
                //     Shout(this, EventArgs.Empty);
                // }
            }
        }
Пример #10
0
        //method
        public void Poke()
        {
            AngerLevel++;

            if (AngerLevel >= 3)
            {
                //if something is listening
                Shout?.Invoke(this, EventArgs.Empty);
                // Same as
                //if (Shout != null)
                //{
                //    // then raise the event
                //    Shout(this, EventArgs.Empty);
                //}
            }
        }
Пример #11
0
        // method
        public void Poke()
        {
            AngerLevel++;
            if (AngerLevel >= 3)
            {
                // if something is listening...

                /*
                 * if (Shout != null)
                 * {
                 *  // ...then call the delegate
                 *  Shout(this, EventArgs.Empty);
                 * }
                 */
                Shout?.Invoke(this, EventArgs.Empty);
            }
        }