1 Replies - 9176 Views - Last Post: 05 January 2011 - 07:44 AM Rate Topic: -----

#1 Guest_skifozoa*


Reputation:

console application versus windows forms application in visual studio

Posted 04 January 2011 - 09:33 PM

Hello everyone

I ran a little test with visual studio 2010 express since I wanted to understand the basics of C# and Visual Studio 2010. However the results of my tests have me puzzled.

the test:
I created a new console application project. Deleted all the files in the solution browser except program.cs and replaced the code by the following simple hello world application(cfr infra). When hitting ctr F5 the console popped up showing the hello world sentence.
Next I went on to create a new windows forms application project. Yet again I deleted all the files in the solution browser except program.cs and guess what I replaced the code by the following simple hello world application(cfr. infra), ctr F5... no console, however.

my confusion:
I was under the impression that the only difference between picking either the console application type or windows forms application type would have been the prewritten code Visual Studio 2010 sets you up with, two different templates so to speak. (i.e. creating the form1 class, instantiating it in program.cs etc...)
However, my test shows me this is not the case. Apparently the build in compiler acts differently depending on your initial choice. My conclusion follows from the fact that I compiled identical program.cs files with different results.

My questions:
1) Is this observation correct? why not?
2) Is there a big difference between the two ways except allowing console acces or not (I haven't tried writing a forms application when initialy selecting console, that would have been my next test)
3) Which of the two compiling procedures is "standard" ? as in: suppose I write my code in notepad and compile the resulting text file with a third party compiler what would then be the result, case1, case2 or even a third case?



Maybe these questions are considered nitpicking? I don't know. But I like to really understand how both different outcomes relate and whether this is a C# issue or rather a visual studio issue. Shouldn't there be some conformity?

Anyway, I thank you in advance for your time and effort in enlightening me.

Kind Regards
Simon





ps:

The code:

using System;
static class Program
    {
        static void Main()
        {
            Console.WriteLine("hello world!");
            Console.ReadLine();
        }
    }



Is This A Good Question/Topic? 0

Replies To: console application versus windows forms application in visual studio

#2 CodeGrappler   User is offline

  • D.I.C Head
  • member icon

Reputation: 41
  • View blog
  • Posts: 120
  • Joined: 29-November 10

Re: console application versus windows forms application in visual studio

Posted 05 January 2011 - 07:44 AM

The real difference between them can be seen by going to...
Project -> Properties -> Application

And you will see a drop down box with the title "Output type:"
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1