Guest User

Untitled

a guest
Jan 21st, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. int i = 5000;
  2. byte b = (byte)i;
  3.  
  4. Console.WriteLine(b); // outputs 136
  5.  
  6. checked
  7. {
  8. int i = 5000;
  9. byte b = (byte)i;
  10.  
  11. Console.WriteLine(b);
  12. }
  13.  
  14. int i = 5000;
  15. byte b = checked ( (byte)i );
  16. Console.WriteLine(b);
  17.  
  18. int i = 256;
  19. byte b = (byte)i;
  20.  
  21. Console.WriteLine(b); // output = 1
  22.  
  23. int i = 257;
  24. byte b = (byte)i;
  25. Console.WriteLine(b); // output = 2
Add Comment
Please, Sign In to add comment