code_junkie

How is null represented in .NET

Nov 13th, 2011
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. int i;
  2. i++;
  3. console.writeline(i);
  4.  
  5. int? i;
  6. i++;
  7. console.writeline(i);
  8.  
  9. int? i;
  10. if (int == 0)
  11. {
  12. //do something
  13. }
  14.  
  15. public int? AddNumbers(int? x, int? y)
  16. {
  17. if (x == null || y == null)
  18. return null;
  19. if (x == 0)
  20. return y;
  21. if (y == 0)
  22. return x;
  23.  
  24. return x + y;
  25. }
Add Comment
Please, Sign In to add comment