Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newby Question
Message
From
08/10/2004 21:30:12
 
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
00950103
Message ID:
00950107
Views:
18
Kevin,

First of all, just because code compiles cleanly, doesn't mean it'll run the way you want it to. <g>

The first line you have a question on is the namespace line? What is a namespace and why do you need it? This is pretty rudimentary concept. Here's one blurb I found in the docs concerning namespaces.
Every component is contained within a namespace. By default, the namespace
 is the name of your project.  Users of your component assembly will add
 Imports (Visual Basic) or using (C#) statements for the namespaces 
containing components they want to access. 

Generally speaking, the structure of namespaces in your component assembly
 should reflect its internal organization. If your assembly contains a 
large number of components, it makes sense to group related components in 
separate namespaces.
So, for example, I have a DataAccess class. It's namespace might be something like this:
namespace MyCompany.DataAccess.Customers
The second line that you have a question on (again, from the docs, or simply by hovering your mouse cursor over it <g>).
		[STAThread]
Indicates that the COM threading model for an application is single-
threaded apartment (STA).
Notice that this is prior to your "static void Main(string[] args)" ... this is the entry-point into your application and is necessary so that the app has a starting point when running.

~~Bonnie



>I have stupid newby quesstions about this c# code. See inline
>questions.
>
>using System;
>
>**** The code compiles fine without this. What is it and why
>**** do I need it
>
>namespace ConsoleApplication1
>{
>	/// <summary>
>	/// Summary description for Class1.
>	/// </summary>
>	class Class1
>	{
>		/// <summary>
>		/// The main entry point for the application.
>		/// </summary>
>
>
>**** Same with this line. Compliles fine without this
>		[STAThread]
>		static void Main(string[] args)
>		{
>			//
>			// TODO: Add code to start application here
>			//
>		}
>	}
>}
>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform