Guest User

Untitled

a guest
Jan 4th, 2013
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. public static readonly List<int> MyList;
  2.  
  3. //Initialize MyList in the static constructor
  4. static MyObject() { ... }
  5.  
  6. public static readonly List<int> MyList = GetMyList();
  7.  
  8. //Returns the list
  9. private static List<int> GetMyList() { ... }
  10.  
  11. public static readonly List<int> MyList =
  12. () =>
  13. {
  14. ...
  15.  
  16. return list;
  17. };
  18.  
  19. () =>
  20. {
  21. ...
  22.  
  23. return list;
  24. };
  25.  
  26. Func<List<int>> createList = () => { ... return list; };
  27. MyList = createList();
  28.  
  29. public static readonly List<int> MyList = new Func<List<int>>(
  30. () =>
  31. {
  32. // Create your list here
  33. return new List<int>();
  34. })();
  35.  
  36. public static readonly List<int> MyList = new Func<List<int>>(() => {
  37. return new List<int>();
  38. })(); //<-- the parentheses that invoke
Add Comment
Please, Sign In to add comment