November 30, 2007

Sample C# Code with Color Coding

The snippet below is a test for c# color scheme in blogger


/*************************************************
* This sample illustrates how to use an ArrayList
* and a foreach loop.
* (from the quickstart tutorials)
**************************************************/
using System;
using System.Collections;

class ListSample
{
public static void Main(String[] args)
{
//create the arraylist and add the items
ArrayList fruit = new ArrayList();
fruit.Add("Apple");
fruit.Add("Pear");
fruit.Add("Orange");
fruit.Add("Banana");

//loop through the arraylist elements
foreach (String item in fruit)
{
Console.WriteLine(item);
}

Console.WriteLine ("\nPress Return to exit.");
Console.Read();
}
}

0 comments: