Sunday, March 1, 2009

C# Class Indexors

Pretty cool feature of C#, for a newbie this is awesome unlike PHP. Say you have 4 class properties

class blah
{
string freddy;
string dafney;
string cave;
string flintstones;
}

And you declared it like:

blah mycartoon;
mycartoon = new blah();

If I wanted to access my classes I wouldn't use a period then the property like:

mycartoon.flintstones;

I can do:

mycartoon[3];

Pretty cool right?

Have fun learning C#