|
using System;
public class MyValue {
public String Name;
}
class CardDeck {
private MyValue[] Cards = new MyValue[52];
public MyValue this[int index] {
get {
return Cards[index];
}
set {
Cards[index] = value;
}
}
public static void Main(String[] args) {
try {
CardDeck PokerDeck = new CardDeck();
MyValue HiddenAce = PokerDeck[53];
} catch (IndexOutOfRangeException e) {
Console.WriteLine(e.Message);
} finally {
// Cleanup code
}
}
}
|
Tags: C# / C Sharp, Class Interface, Code, Indexer, Indexer laquo Class Interface laquo C C Sharp, Return class object from indexer
Posted in Uncategorized |
This entry was posted
on Thursday, July 9th, 2009 at 8:00 pm and is filed under Uncategorized.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.