A step by step tutorial teaching you how to create your own chat client and chat server easily in C#, for local networks or the Internet.
A C# tutorial showing you how to make use of WMI to extract information on disk drives, such as model, capacity, sectors and serial number.
This tutorial will teach you how to calculate the shipping cost based on the weight, height, length and depth of the box, the distance and the UPS service type.
This tutorial explains what a jagged array by giving an example that shows you how set and retrieve values.
On Sunday, July 25th 2004 at 11:34 PM
By Andrew Pociu (View Profile)
(Rated 4.6 with 17 votes)
It's not so hard to comprehend this. In the following example we declare jaggedArray named jArray that can hold 3 other arrays:
Next you can set the size (number of elements) of each of the 3 arrays:
The first array (0) has 2 elements, the second (1) has 5 elements and the third (2) has 7 elements.
How do we assign and retrieve values from the elements of each array?
As you can see in the followin graphic, first we specify the number of the array, second we specify the number of the element:
In the following example we assign values to all the elements in all 3 arrays:
Using two loops we can retrieve the values of the elements from all the arrays inside the jagged array:
If you compile the code, here's the result in the console window:
|Digg It! Del.icio.us Reddit StumbleIt Newsvine Furl BlinkList|
Rate this tutorial
There are no related tutorials.
Related Source Code
There is no related source code.
C# Job Search