Click here to Skip to main content
15,907,910 members
Home / Discussions / C#
   

C#

 
QuestionOutlook 2003 Add-In with C#? Pin
fcn][Stampede24-Jul-05 2:07
fcn][Stampede24-Jul-05 2:07 
AnswerRe: Outlook 2003 Add-In with C#? Pin
Brian Delahunty24-Jul-05 2:20
Brian Delahunty24-Jul-05 2:20 
Generalnmake for c# Pin
Mingzhi_8624-Jul-05 1:11
Mingzhi_8624-Jul-05 1:11 
GeneralRe: nmake for c# Pin
Michael P Butler24-Jul-05 2:12
Michael P Butler24-Jul-05 2:12 
GeneralPopulate values in data grid based on few conditions Pin
lovelylooney23-Jul-05 23:14
lovelylooney23-Jul-05 23:14 
GeneralRe: Populate values in data grid based on few conditions Pin
Alomgir Miah24-Jul-05 11:30
Alomgir Miah24-Jul-05 11:30 
GeneralClass... Arrays... Collections... Arg! Pin
MNiece23-Jul-05 17:29
MNiece23-Jul-05 17:29 
GeneralRe: Class... Arrays... Collections... Arg! Pin
Rob Graham23-Jul-05 18:23
Rob Graham23-Jul-05 18:23 
An array is just a data structure, not a class on its own
An ArrayList, on the other hand, is a class - it has both data and behavior (methods) related to that data.

For what you want to do, an ArrayList (or perhaps even better a HashTable) would be a good choice. An arraylist instance contains a list of objects ( your servers, which could be your list of services, perhaps complex objects themselves, or just simple string service names).
public class Servers
{
   private HashTable ServerList = new HashTable();
   public Servers(){};
   public void Add(string Servername, Server s)
   {
      ServerList.Add(serverName, s); 
   }

  public Server GetServer( string serverName)
  { 
    return (Server)Serverlist[Servername];
   }
}
public class Server
{
   private HashTable ServicesList = new HashTable();
   private string serverName = string.Empty;
   public Server(string ServerName)
   {
     this.serverName = Servername;
   }
   public void AddService( string serviceName, Service srv)
   {
      ServiceList.Add(serviceName,srv);
   }
}


and so on...
Note code above is off the top of the head, errors likely.
[edit]

I used a HashTable, because it gives very fast lookups of the key for even large lists. With the ArrayList, lookups are linear with the number of entries, but it is easier to iterate (and to conceptualize).
[/edit]
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer

All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke

GeneralRe: Class... Arrays... Collections... Arg! Pin
MNiece25-Jul-05 2:23
MNiece25-Jul-05 2:23 
GeneralRe: Class... Arrays... Collections... Arg! Pin
Rob Graham25-Jul-05 3:25
Rob Graham25-Jul-05 3:25 
GeneralDatagrid Pin
Srinivas Jonnalagadda23-Jul-05 7:45
Srinivas Jonnalagadda23-Jul-05 7:45 
GeneralRe: Datagrid Pin
Christian Graus23-Jul-05 11:02
protectorChristian Graus23-Jul-05 11:02 
GeneralRe: Datagrid Pin
Srinivas Jonnalagadda23-Jul-05 13:27
Srinivas Jonnalagadda23-Jul-05 13:27 
GeneralRe: Datagrid Pin
Christian Graus23-Jul-05 13:50
protectorChristian Graus23-Jul-05 13:50 
GeneralRe: Datagrid Pin
Srinivas Jonnalagadda23-Jul-05 16:02
Srinivas Jonnalagadda23-Jul-05 16:02 
GeneralRe: Datagrid Pin
Srinivas Jonnalagadda23-Jul-05 17:47
Srinivas Jonnalagadda23-Jul-05 17:47 
GeneralRe: Datagrid Pin
Christian Graus24-Jul-05 12:51
protectorChristian Graus24-Jul-05 12:51 
GeneralArrayList of value types Pin
Luis Alonso Ramos23-Jul-05 6:53
Luis Alonso Ramos23-Jul-05 6:53 
GeneralRe: ArrayList of value types Pin
KaptinKrunch23-Jul-05 7:26
KaptinKrunch23-Jul-05 7:26 
GeneralRe: ArrayList of value types Pin
Wyxlwiis23-Jul-05 7:45
Wyxlwiis23-Jul-05 7:45 
GeneralRe: ArrayList of value types Pin
Luis Alonso Ramos23-Jul-05 8:27
Luis Alonso Ramos23-Jul-05 8:27 
GeneralRe: ArrayList of value types Pin
DavidNohejl23-Jul-05 8:45
DavidNohejl23-Jul-05 8:45 
GeneralRe: ArrayList of value types Pin
Luis Alonso Ramos23-Jul-05 9:38
Luis Alonso Ramos23-Jul-05 9:38 
GeneralRe: ArrayList of value types Pin
Wyxlwiis23-Jul-05 10:11
Wyxlwiis23-Jul-05 10:11 
GeneralRe: ArrayList of value types Pin
Luis Alonso Ramos23-Jul-05 15:10
Luis Alonso Ramos23-Jul-05 15:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.