Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

newbie questions - in consle app I acan only have 1 main void 1

Status
Not open for further replies.

Gzk2010

Programmer
Aug 17, 2010
48
US
1. when I get go tutorials from the web, lots are for console apps.
I have been an entry level c# web devcloper. so when I create a new class in my console project I jave to comment out all the code of all the other classes for my latest to run. Its a dumb question.


2. next dumb question i tried googling - what is the I in front of .net things. like IPrinciple?
 
1.
Code:
internal static class Program
{
   [STAThread]
   private static void Main()
   {
   }
}
is the entry point into a console application. just like Global.Application_Start is the entry point into asp.net.

One you enter the application you can instantiate new objects. for example
Code:
internal static class Program
{
   [STAThread]
   private static void Main()
   {
       new MyObject().DoSomething();
   }
}
a winforms application isn't that much different.
Code:
internal static class Program
{
   [STAThread]
   private static void Main()
   {
      Application.EnableVisualStyles();
      Application.SetCompatibleTextRenderingDefault(false);
      Application.Run(new MyContext());
   }
}

2.
I[xxx] is a naming convention. it signifies the object is an interface, not an implementation. this is purely a manual convention.
(You could use a tool like ncover to ensure all interfaces start with "I", but that still not a requirement.)

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top