Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static readonly List<int> MyList;
- //Initialize MyList in the static constructor
- static MyObject() { ... }
- public static readonly List<int> MyList = GetMyList();
- //Returns the list
- private static List<int> GetMyList() { ... }
- public static readonly List<int> MyList =
- () =>
- {
- ...
- return list;
- };
- () =>
- {
- ...
- return list;
- };
- Func<List<int>> createList = () => { ... return list; };
- MyList = createList();
- public static readonly List<int> MyList = new Func<List<int>>(
- () =>
- {
- // Create your list here
- return new List<int>();
- })();
- public static readonly List<int> MyList = new Func<List<int>>(() => {
- return new List<int>();
- })(); //<-- the parentheses that invoke
Add Comment
Please, Sign In to add comment