[Serializable] |
Only signle-dimensional arrays can be created with a CodeArrayCreateExpression. It is possible to create arrays of arrays by nesting a CodeArrayCreateExpression within another. Not all languages support arrays of arrays. Support for nested arrays should be checked for by calling ICodeGenerator.Supports with the GeneratorSupport.ArraysOfArrays flag.
Most arrays can be initialized immediately following declaration. The CodeArrayCreateExpression.Initializers property can be set to the expression to use to initialize the array.
array1
for an array of integers with 10 indices: CodeArrayCreateExpression array1 = new CodeArrayCreateExpression( typeof(int), 10);
The CodeDOM representation created in the above example will generate the following source code:
[C#]
new int[10];
ctor #1 | Overloaded:.ctor() Default constructor. This constructor is called by derived class constructors to initialize state in this type.Initializes a new instance of the CodeArrayCreateExpression class. |
ctor #2 | Overloaded:.ctor(CodeTypeReference createType, CodeExpression size) Initializes a new instance of the CodeArrayCreateExpression class using the specified array data type and code expression indicating the number of indices for the array. |
ctor #3 | Overloaded:.ctor(CodeTypeReference createType, params CodeExpression[] initializers) Initializes a new instance of the CodeArrayCreateExpression class using the specified array data type and initialization expressions. |
ctor #4 | Overloaded:.ctor(CodeTypeReference createType, int size) Initializes a new instance of the CodeArrayCreateExpression class using the specified array data type and number of indices for the array. |
ctor #5 | Overloaded:.ctor(string createType, CodeExpression size) Initializes a new instance of the CodeArrayCreateExpression class using the specified array data type name and code expression indicating the number of indices for the array. |
ctor #6 | Overloaded:.ctor(string createType, params CodeExpression[] initializers) Initializes a new instance of the CodeArrayCreateExpression class using the specified array data type name and initializers. |
ctor #7 | Overloaded:.ctor(string createType, int size) Initializes a new instance of the CodeArrayCreateExpression class using the specified array data type name and number of indices for the array. |
ctor #8 | Overloaded:.ctor(Type createType, CodeExpression size) Initializes a new instance of the CodeArrayCreateExpression class using the specified array data type and code expression indicating the number of indices for the array. |
ctor #9 | Overloaded:.ctor(Type createType, params CodeExpression[] initializers) Initializes a new instance of the CodeArrayCreateExpression class using the specified array data type and initializers. |
ctor #10 | Overloaded:.ctor(Type createType, int size) Initializes a new instance of the CodeArrayCreateExpression class using the specified array data type and number of indicies for the array. |
CreateType | Read-write Gets or sets the type of array to create. |
Initializers | Read-only Gets the initializers with which to initialize the array. |
Size | Read-write Gets or sets the number of indices in the array. |
SizeExpression | Read-write Gets or sets the expression that indicates the size of the array. |
UserData (inherited from System.CodeDom.CodeObject) |
Read-only See base class member description: System.CodeDom.CodeObject.UserData Gets or sets the user-definable data for the current object. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public CodeArrayCreateExpression(); |
public CodeArrayCreateExpression( |
createType
size
public CodeArrayCreateExpression( |
createType
initializers
public CodeArrayCreateExpression( |
createType
size
public CodeArrayCreateExpression( |
createType
size
public CodeArrayCreateExpression( |
createType
initializers
createType
size
public CodeArrayCreateExpression( |
createType
size
public CodeArrayCreateExpression( |
createType
initializers
createType
size
public CodeTypeReference CreateType {get; set;}
|
public CodeExpressionCollection Initializers {get;}
|
public int Size {get; set;}
|
public CodeExpression SizeExpression {get; set;}
|
public IDictionary UserData {get;}
|
~CodeArrayCreateExpression(); |
public virtual int GetHashCode(); |
public Type GetType(); |
protected object MemberwiseClone(); |
public virtual string ToString(); |