console or forms

  • Thread starter Thread starter RobcPettit
  • Start date Start date
R

RobcPettit

Hi, This is probably a mute point, but id like to know when to choose a
console application to a windows application. What i meen is this. Most
coding in books is with the console application. I think this is
possibly because as a beginner its easier to demonstrate c# principles.
But I got to thinking if Im writing an application that needs no user
input, and the only information shown to the user is how many records
are proccesed, do i choose console over window app. Im thinking from
speed of proccesing. Also, and this very much an exploratory area for
me, but does threading apply to console applications as well.
Regards Robert
 
In my opinion, console applications are only for tasks that require no
user input. I've built several, but they were all for batch processing
in our organization. If I require user interaction then I write a
WinForms application.

Speed of processing should not be a consideration in making this
choice. I can think of no situation in which choice of user interface
should be driven by speed considerations.
 
My style is that if I'm writing a single-purpose app, which could
reasonably be a console, I'd write a class that did the real work to
accept all parameters in it's constructor.

I would then write a Winform which accepted the parameters, with a [Go]
button, which created the object to do the work, using the parameters,
from the form.

Then, in the Main() method, I'd look for command line parameters. If
none, I'd launch the winform. If there are commandline parameter, I'd
allocate a console (see:
http://www.pinvoke.net/default.aspx/kernel32.AllocConsole), create the
object using the comand--line arguments, and run it as a console app.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top