/*
Learning C#
by Jesse Liberty
Publisher: O'Reilly
ISBN: 0596003765
*/
using System;
namespace ArrayDemo
{
// a simple class to store in the array
class Employee
{
private int empID;
// constructor
public Employee(int empID)
{
this.empID = empID;
}
}
public class TesterArrayDemoInit
{
public void Run()
{
int[] intArray;
Employee[] empArray;
intArray = new int[5];
empArray = new Employee[3];
// populate the array
for (int i = 0;i<empArray.Length;i++)
{
empArray[i] = new Employee(i+5);
}
}
[STAThread]
static void Main()
{
TesterArrayDemoInit t = new TesterArrayDemoInit();
t.Run();
}
}
}
|