mjc65

Example 1-48. Short-circuiting the OR operator

Jun 23rd, 2020
881
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.19 KB | None | 0 0
  1. public void OrShortCircuit()
  2. {
  3.     bool x = true;
  4.     bool result = x || GetY();
  5. }
  6.  
  7. private bool GetY()
  8. {
  9.     Console.WriteLine("This method doesn't get called");
  10.     return true;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment