Created
October 2, 2014 16:18
-
-
Save tbowers/cea8721a24e857bd8e78 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace ConsoleApplication1 | |
{ | |
public class Something | |
{ | |
int[] things; | |
public Something() { | |
things = new int[10000000]; | |
Random rnd = new Random(); | |
for (int i = 0; i < things.Length; ++i) { | |
things[i] = rnd.Next(); | |
} | |
} | |
} | |
static public class SomethingFactory | |
{ | |
private static List<Something> listOfSomethings = new List<Something>(); | |
public static Something CreateSomething() { | |
Something something = new Something(); | |
listOfSomethings.Add(something); | |
return something; | |
} | |
} | |
class Program | |
{ | |
static void Main(string[] args) { | |
while (true) { | |
Console.ReadKey(); | |
Console.WriteLine("Creating..."); | |
Something s = SomethingFactory.CreateSomething(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment