code_junkie

static method or instance constructor

Nov 11th, 2011
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. public class Foo
  2. {
  3. private Foo() { }
  4.  
  5. private static List<Foo> FooList = new List<Foo>();
  6. public static Foo CreateFoo()
  7. {
  8. Foo f = new Foo();
  9. FooList.Add(f);
  10. return f;
  11. }
  12. }
  13.  
  14. Foo f = Foo.CreateFoo();
  15. Bar b = new Bar();
Add Comment
Please, Sign In to add comment