SHOW:
|
|
- or go back to the newest paste.
| 1 | using System; | |
| 2 | using System.Collections.Generic; | |
| 3 | using System.Diagnostics; | |
| 4 | ||
| 5 | namespace Sharp | |
| 6 | {
| |
| 7 | class Program | |
| 8 | {
| |
| 9 | class Foo | |
| 10 | {
| |
| 11 | - | int i; |
| 11 | + | public int i; |
| 12 | public Foo(int ii) | |
| 13 | {
| |
| 14 | i = ii; | |
| 15 | } | |
| 16 | } | |
| 17 | ||
| 18 | static void Main(string[] args) | |
| 19 | {
| |
| 20 | const int SIZE = 10000000; | |
| 21 | ||
| 22 | Foo[] foos = new Foo[SIZE]; | |
| 23 | ||
| 24 | var timer = new Stopwatch(); | |
| 25 | ||
| 26 | timer.Start(); | |
| 27 | ||
| 28 | for (int i = 0; i < SIZE; ++i) | |
| 29 | {
| |
| 30 | foos[i] = new Foo(i); | |
| 31 | } | |
| 32 | ||
| 33 | System.Console.WriteLine(timer.ElapsedMilliseconds); | |
| 34 | ||
| 35 | System.IO.StreamWriter fout = new System.IO.StreamWriter("ints.txt");
| |
| 36 | ||
| 37 | for (int i = 0; i < SIZE; ++i) | |
| 38 | {
| |
| 39 | fout.WriteLine(foos[i].i); | |
| 40 | } | |
| 41 | } | |
| 42 | } | |
| 43 | } |