J
Jeff User
Hi
I want to create a rather simple object with a few string attributes
to hold some database user information such as:
public class UserInfo
{
//Basic user information for each user associated with a database.
private string sDbName;
private string sUserName;
.... other stuff....
public string dbName
{
get {...} set{ }
}
public string UserName
{ ........etc.etc....
}
......more stuff
}
There can be many UserInfo objects for each database.
Then, I was thinking another object , say dbUsers, that contains many
UserInfo objects. One dbUsers object for each database. (Maybe now, I
would not need to keep the dbName in the UserInfo object as all
UserInfo objects would always belong to some dbUsers object.
And finally, an object, say AllDbsAndUsers to hold all dbUser
objects.
I would create one dbUser object at a time, populate it with several
UserInfo objects, for a particular db, and then "add" it to the
AllDbsAndUsers object.
To use AllDbsAndUsers I would like to be able to "add" objects, get
objects based on db name, etc...
It will be handy in several situations to be able to use foreach loops
to run through one object, while processing the inner objects.
I am looking at IEnumerable, IEnumerator, IDictionary, DictionaryBase
and Hashtables. I really am not sure where to begin.
Is there also an Interface called Iterator?
What is the basic minimum needed any any object to be able to use a
foreach loop?
Are the requirements different if I want to have an "add" method?
Thanks
Jeff
"I'll get this sooner or later"
I want to create a rather simple object with a few string attributes
to hold some database user information such as:
public class UserInfo
{
//Basic user information for each user associated with a database.
private string sDbName;
private string sUserName;
.... other stuff....
public string dbName
{
get {...} set{ }
}
public string UserName
{ ........etc.etc....
}
......more stuff
}
There can be many UserInfo objects for each database.
Then, I was thinking another object , say dbUsers, that contains many
UserInfo objects. One dbUsers object for each database. (Maybe now, I
would not need to keep the dbName in the UserInfo object as all
UserInfo objects would always belong to some dbUsers object.
And finally, an object, say AllDbsAndUsers to hold all dbUser
objects.
I would create one dbUser object at a time, populate it with several
UserInfo objects, for a particular db, and then "add" it to the
AllDbsAndUsers object.
To use AllDbsAndUsers I would like to be able to "add" objects, get
objects based on db name, etc...
It will be handy in several situations to be able to use foreach loops
to run through one object, while processing the inner objects.
I am looking at IEnumerable, IEnumerator, IDictionary, DictionaryBase
and Hashtables. I really am not sure where to begin.
Is there also an Interface called Iterator?
What is the basic minimum needed any any object to be able to use a
foreach loop?
Are the requirements different if I want to have an "add" method?
Thanks
Jeff
"I'll get this sooner or later"