English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

public class MyClass
{
public static void Main()
{
Container[] containerArray = new Container[10];
for( int i=0; i < containerArray.Length; i++ ){
containerArray[i] = new Container( i );
}
Container[] containerArrayCopy = new Container[10];
containerArray.CopyTo( containerArrayCopy, 0 );
containerArrayCopy[2].V = 3;
for( int i=0; i < containerArray.Length; i++ ){
Console.Write( "{0}, ", containerArray[i].V );
}
Console.WriteLine();
}

}

public class Container{
public int V;
public Container(int i ){
V = i;
}
}

2007-03-08 00:52:35 · 1 answers · asked by terrabytes404 2 in Computers & Internet Programming & Design

1 answers

I'm assuming that's C# code.
Using the mono compiler, which is free.

As is it won't compile:

MyClass.cs(13,1): error CS0103: The name `Console' does not exist in the context of `MyClass'
MyClass.cs(15,1): error CS0103: The name `Console' does not exist in the context of `MyClass'
Compilation failed: 2 error(s), 0 warnings

Add "using System;" and you get:

0, 1, 3, 3, 4, 5, 6, 7, 8, 9,

2007-03-09 12:52:12 · answer #1 · answered by John Mahowald 5 · 0 0

fedest.com, questions and answers