Guest User

Untitled

a guest
Jan 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. public void PrintStars(object o)
  2. {
  3. if (o is null) return; // constant pattern "null"
  4. if (!(o is int i)) return; // type pattern "int i"
  5. WriteLine(new string('*', i));
  6. }
  7.  
  8. public static bool Equals(Object objA, Object objB)
  9. {
  10. if (objA == objB)
  11. {
  12. return true;
  13. }
  14. if (objA == null || objB == null)
  15. {
  16. return false;
  17. }
  18. return objA.Equals(objB);
  19. }
  20.  
  21. int? a = null;
  22. if (a is null) { /* */ }
Add Comment
Please, Sign In to add comment