mirror of https://github.com/icsharpcode/ILSpy.git
3 changed files with 32 additions and 1 deletions
@ -0,0 +1,30 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
|
||||||
|
public static class Generics |
||||||
|
{ |
||||||
|
class MyArray<T> |
||||||
|
{ |
||||||
|
private T[] arr; |
||||||
|
|
||||||
|
public MyArray(int capacity) |
||||||
|
{ |
||||||
|
this.arr = new T[capacity]; |
||||||
|
} |
||||||
|
|
||||||
|
public void Size(int capacity) |
||||||
|
{ |
||||||
|
Array.Resize(ref this.arr, capacity); |
||||||
|
} |
||||||
|
|
||||||
|
public void Grow(int capacity) |
||||||
|
{ |
||||||
|
if (capacity >= this.arr.Length) |
||||||
|
{ |
||||||
|
this.Size(capacity); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue