Click here to Skip to main content
16,005,181 members
Home / Discussions / C#
   

C#

 
AnswerRe: ildasm.exe Pin
ednrgc22-Nov-06 2:17
ednrgc22-Nov-06 2:17 
AnswerRe: ildasm.exe Pin
Paul Conrad22-Nov-06 4:25
professionalPaul Conrad22-Nov-06 4:25 
QuestionGet the remote username of a file action Pin
ronjon_nl22-Nov-06 0:57
ronjon_nl22-Nov-06 0:57 
QuestionReplacing a string in a file Pin
sanki77922-Nov-06 0:29
sanki77922-Nov-06 0:29 
AnswerRe: Replacing a string in a file Pin
stancrm22-Nov-06 0:34
stancrm22-Nov-06 0:34 
GeneralRe: Replacing a string in a file Pin
sanki77922-Nov-06 1:13
sanki77922-Nov-06 1:13 
GeneralRe: Replacing a string in a file Pin
stancrm22-Nov-06 1:15
stancrm22-Nov-06 1:15 
QuestionHow can I have access to an arraylist Pin
Schmullus21-Nov-06 23:40
Schmullus21-Nov-06 23:40 
Hi there,

I have the following problem:
I want to add a variable 'myServerInfo' to an arraylist.
This variable is of the datatyp 'ServerInfo' (public class).
I can add this variable without any problems to the arraylist with
the command:

<br />
myServerArrayList.Add(myServerInfo);<br />


But how can I have access to this through the arraylist?
If I type in the following commandline, Intellisense will not
provide me the necessary information:

<br />
Console.WriteLine(myServerArrayList[0].???<br />


I thought I can type in:

<br />
Console.WriteLine(myServerArrayList[0].strServerName);<br />
Console.WriteLine(myServerArrayList[0].strServerIP);<br />
Console.WriteLine(myServerArrayList[0].strServerNetMask);<br />



My complete code for this example is like:


<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using System.Collections;<br />
<br />
namespace ConsoleApplication1<br />
{<br />
    public class ServerInfo<br />
    {<br />
        public string strServerName;<br />
        public string strServerIP;<br />
        public string strServerNetMask;<br />
    }<br />
<br />
    class Program<br />
    {<br />
        static void Main(string[] args)<br />
        {<br />
            ArrayList myServerArrayList = new ArrayList();<br />
            ServerInfo myServerInfo = new ServerInfo();<br />
            myServerInfo.strServerName = "Server 1";<br />
            myServerInfo.strServerIP = "192.168.0.1";<br />
            myServerInfo.strServerNetMask = "255.255.255.0";<br />
            // Add to ArrayList<br />
            myServerArrayList.Add(myServerInfo);<br />
            Console.WriteLine(myServerArrayList[0].???<br />
        }<br />
    }<br />
}


If anybody gives me a hint,
I can go on with my project.Smile | :)

Thanks in advance

Erik
AnswerRe: How can I have access to an arraylist Pin
Guffa21-Nov-06 23:47
Guffa21-Nov-06 23:47 
GeneralRe: How can I have access to an arraylist Pin
Schmullus22-Nov-06 0:17
Schmullus22-Nov-06 0:17 
GeneralRe: How can I have access to an arraylist Pin
ejuanpp22-Nov-06 0:55
ejuanpp22-Nov-06 0:55 
GeneralRe: How can I have access to an arraylist Pin
Guffa22-Nov-06 5:36
Guffa22-Nov-06 5:36 
AnswerRe: How can I have access to an arraylist Pin
ejuanpp21-Nov-06 23:51
ejuanpp21-Nov-06 23:51 
AnswerRe: How can I have access to an arraylist Pin
George L. Jackson21-Nov-06 23:54
George L. Jackson21-Nov-06 23:54 
GeneralRe: How can I have access to an arraylist Pin
Schmullus22-Nov-06 0:23
Schmullus22-Nov-06 0:23 
GeneralRe: How can I have access to an arraylist Pin
Russell Jones22-Nov-06 0:44
Russell Jones22-Nov-06 0:44 
GeneralRe: How can I have access to an arraylist Pin
Schmullus22-Nov-06 5:19
Schmullus22-Nov-06 5:19 
AnswerRe: How can I have access to an arraylist Pin
bes200522-Nov-06 0:30
bes200522-Nov-06 0:30 
QuestionControlling the focus in WindowsForms Pin
Dobromir Dimitrov21-Nov-06 23:32
Dobromir Dimitrov21-Nov-06 23:32 
QuestionContext menu on a TreeView Pin
Sonu.T21-Nov-06 23:25
Sonu.T21-Nov-06 23:25 
AnswerRe: Context menu on a TreeView Pin
Schmullus22-Nov-06 0:09
Schmullus22-Nov-06 0:09 
Questionexchange data between db2 (as400) and ms sql server Pin
amilapradeep21-Nov-06 22:43
amilapradeep21-Nov-06 22:43 
AnswerRe: exchange data between db2 (as400) and ms sql server Pin
Mridang Agarwalla22-Nov-06 5:10
Mridang Agarwalla22-Nov-06 5:10 
QuestionDrawImage to Bitmap? Pin
s4_sabahatf21-Nov-06 22:40
s4_sabahatf21-Nov-06 22:40 
AnswerRe: DrawImage to Bitmap? Pin
Eduard Keilholz21-Nov-06 22:49
Eduard Keilholz21-Nov-06 22:49 

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.