Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. public T this[int i]
  2. {
  3. get
  4. {
  5. T item = default(T);
  6.  
  7. if (list.Count > 0)
  8. {
  9. if (i < list.Count && i >= 0)
  10. {
  11. item = list[(list.Count - 1) - i];
  12. }
  13. else
  14. {
  15. throw new ArgumentOutOfRangeException();
  16. }
  17. }
  18.  
  19. return item;
  20. }
  21.  
  22. set
  23. {
  24. if (list.Count > 0)
  25. {
  26. if (i < list.Count && i >= 0)
  27. {
  28. list[(list.Count - 1) - i] = value;
  29. }
  30. else
  31. {
  32. throw new ArgumentOutOfRangeException();
  33. }
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement