コード例 #1
0
 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
ファイル: Person.cs プロジェクト: Oleh1989/Mark_Price_6
 // method
 public void Poke()
 {
     AngerLevel++;
     if (AngerLevel >= 3)
     {
         // if somebody listens us...
         //... then event raises
         Shout?.Invoke(this, EventArgs.Empty);
     }
 }
コード例 #5
0
ファイル: Person.cs プロジェクト: AlexGruebel/CSharpTraining
 // 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
ファイル: Person.cs プロジェクト: bryanleonard/PacktLibrary
        //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
ファイル: Person.cs プロジェクト: alaniv/NetCoreExcercises
        // 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);
            }
        }