Ajax
ASP
C,C++
C#,.NET
CSS,HTML
Delphi,Kylix
Experience
Flash
Java
JavaScript
PHP
Python
QT
SQL
ShellScript
VB
U :
P :
Register
Lost Password
Other Links
Code Archive
Save Giovanni
C#,.NET Category Code
Real Name
:
SharingCode.NET User
Subject
:
Class Array
Description
:
Class Array
/* 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 override string ToString() { return empID.ToString(); } } public class TesterClassArray { 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); } Console.WriteLine("The int array..."); for (int i = 0;i<intArray.Length;i++) { Console.WriteLine(intArray[i].ToString()); } Console.WriteLine("\nThe employee array..."); for (int i = 0;i<empArray.Length;i++) { Console.WriteLine(empArray[i].ToString()); } } [STAThread] static void Main() { TesterClassArray t = new TesterClassArray(); t.Run(); } } }
Rating
:
5.00
(out of 5)
Visitor Voting Booth
:
Excellent
Very Good
Good
Fair
Poor
Copyright © 2006 SharingCode.NET . All rights reserved. Hosted By: SisNetworks