Simple program not producing output

1 view
Skip to first unread message

garyu...@myway.com

unread,
Nov 30, 2006, 6:30:56 AM11/30/06
to
Hi.

I am trying to learn about array lists, and found an example on MSDN. I
tried to compile it but it's not producing any output. I can't see why.
Any ideas?

Here is what I did.

1. Started new windows application.
2. Deleted the code files (program.cs, form.cs)
3. Created a new code file.
4. Pasted the MSDN code into this code file.
5. Pressed F5. Nothing happened, no errors nothing.
6. Chose Build from the explorer pane.
7. When to a command shell, located the exe.
8. Run the exe, and i just got a blank line and returned to command
prompt.

Here is the code, why is it behaving like this? : -

using System;
using System.Collections;
public class SamplesArrayList
{

public static void Main()
{

// Creates and initializes a new ArrayList.
ArrayList myAL = new ArrayList();
myAL.Add("Hello");
myAL.Add("World");
myAL.Add("!");

// Displays the properties and values of the ArrayList.
Console.WriteLine("myAL");
Console.WriteLine(" Count: {0}", myAL.Count);
Console.WriteLine(" Capacity: {0}", myAL.Capacity);
Console.Write(" Values:");
PrintValues(myAL);
}

public static void PrintValues(IEnumerable myList)
{
foreach (Object obj in myList)
Console.Write(" {0}", obj);
Console.WriteLine();
}

}


/*
This code produces output similar to the following:

myAL
Count: 3
Capacity: f
Values: Hello World !

*/

thankyou,

Gary.

Stephany Young

unread,
Nov 30, 2006, 6:50:53 AM11/30/06
to
Gary!

I just followed your steps 1 through 5 and this is what I got:

<loading of various assemblies snipped>
The thread 0x7a8 has exited with code 0 (0x0).
The thread 0x974 has exited with code 0 (0x0).
'WindowsApplication8.vshost.exe' (Managed): Loaded
'D:\MBS\WindowsApplication8\bin\Debug\WindowsApplication8.exe', Symbols
loaded.
myAL
Count: 3
Capacity: 4
Values: Hello World !
The thread 0xe4 has exited with code 0 (0x0).
The thread 0x470 has exited with code 0 (0x0).
The program '[1564] WindowsApplication8.vshost.exe: Managed' has exited
with code 0 (0x0).

Did you bother to look in the output window after you pressed F5. If not
then where did you expect the output to be displayed? You have deleted the
form that the wizard nicely created for you and there is no console. If you
insist in doing it this way then go to the Application tab of the project
Properties and change the Output Type to 'Console Application'. Then when
you run the exe from a command prompt you will see the output.

If you had created a new Console Application project in the first place you
would not have had this 'problem'.

Again I'm going to sound crabby, but please don't treat these newsgoups as
your primary help resource.
YOUR PRIMARY HELP RESOURCE IS ALWAYS THE F1 KEY!!!!!!!!!


<garyu...@myway.com> wrote in message
news:1164886256.1...@16g2000cwy.googlegroups.com...

garyu...@myway.com

unread,
Nov 30, 2006, 7:05:03 AM11/30/06
to
Hi Stephany,

I find the F1 key too verbose, I have learnt all i know so far from
asking people in these forums and reading the ECMA specification (which
isn't half as verbose as the F1).

Stephany Young

unread,
Nov 30, 2006, 7:14:04 AM11/30/06
to
And it shows!

As you are effectively saying that you are too lazy to read the
documentation then I think this will my last
response to any of your posts!

<garyu...@myway.com> wrote in message
news:1164888303.3...@n67g2000cwd.googlegroups.com...

garyu...@myway.com

unread,
Nov 30, 2006, 7:39:41 AM11/30/06
to
That is not what I said. I didn't use too verbose as a synonym for too
time consuming.

F1 is ok as a technical reference. It does not however provide answers
to often technically incorrect questions. As a beginner my questions
are often technically incorrect. Further it is not able to provide
solutions to proposed problems, when the problem is often phrased in
completely the wrong way or itself completely misunderstood.

Thanks to the many kind hearted people in these forums I am slowly
becoming more confident at programming, and finding it very enjoyable.
I owe them a great debt, and think their kindness and patience truly
inspiring and motivating.

If my posts have caused annoyance to you please accept my apologies.

Reply all
Reply to author
Forward
0 new messages