D
daz_oldham
Hi everyone
I am just trying to find how to implement Indexers... or at least that
is what I think I want to implement!
Very basically, in my database I have a table of T_Hotels which has
many entries in T_Rooms.
In my C#, I would like to be able to go:
// Get a new instance of the Hotel object for a given hotel ID
Hotel oHotel = new Hotel(iHotelID);
// Write down the name of all the rooms in the oHotelObject
for(Int32 i=0; i<oHotel.Rooms.Count; i++)
{
Response.Write(oHotel.Rooms.Name);
}
The actual making of the classes and setting the base type I am fine
with, it is just the creation of the array of children (rooms) that I
am struggling with.
Many thanks in advance
Darren
I am just trying to find how to implement Indexers... or at least that
is what I think I want to implement!
Very basically, in my database I have a table of T_Hotels which has
many entries in T_Rooms.
In my C#, I would like to be able to go:
// Get a new instance of the Hotel object for a given hotel ID
Hotel oHotel = new Hotel(iHotelID);
// Write down the name of all the rooms in the oHotelObject
for(Int32 i=0; i<oHotel.Rooms.Count; i++)
{
Response.Write(oHotel.Rooms.Name);
}
The actual making of the classes and setting the base type I am fine
with, it is just the creation of the array of children (rooms) that I
am struggling with.
Many thanks in advance
Darren