using and array

  • Thread starter Thread starter Marco Segurini
  • Start date Start date
M

Marco Segurini

HI,

Is there a way to declare an alias for an array type?

using typeInt32Array = System.Int32[];

TIA.
Marco.
 
Hello Marco,
Is there a way to declare an alias for an array type?
using typeInt32Array = System.Int32[];

Not directly. In the "using directive" you can only use a
namespace or class *name* .

[using Directive]
http://msdn.microsoft.com/library/en-us/csref/html/vclrfusingdirective.asp

But you can do sth. like this :

public class IntArr
{ public IntArr(int capacity) {intArr=new int[capacity];}
private int[] intArr;
public int this[int index]
{ get{return intArr[index] ;}
set{intArr[index] = value;}
}
}

/*e.g. in Form_Load */ IntArr myArr = new IntArr(1); myArr[0]=42;



ciao Frank
 
Back
Top