Index
[]applicationsweb [See web applications]Windows [See Windows applications]ASP.NETforms-based security [See forms-based security]personalization [See personalized web sites]ASP.NET Web Site Administration Tool (WAT)BackgroundWorker object [See BackgroundWorker object]AutoCompleteModeAutoCompleteSource
Index
[]binding data [See data binding]browser [See WebBrowser control]browser events
Index
[]anonymous methods [See anonymous methods]generics [See generics]iterators [See iterators]nullable types [See nullable types]partial types [See partial types]static classes [See static classes]classesLinkedList [See LinkedList class]List [See List class]splitting across files [See partial keyword]static [See static classes]code snippetsComboBox controlauto-complete [See auto-complete text boxes]
Index
[]datainteracting without ADO.NET [See data-bound controls]XML documents [See XmlDataSource control]debuggingDefault.aspx
Index
[]exceptions
Index
[]formsFlowLayoutPanel control [See FlowLayoutPanel control]TableLayoutPanel control [See TableLayoutPanel control]
Index
[]generic classesGeneric namespaceglobal namespacequalifier
Index
[]
Index
[]IISIIS Administratoriterators
Index
[]
Index
[]LinkedList class
Index
[]MaskedTextBoxMaskedTextBox classmethodsanonymous [See anonymous methods]BackgroundWorker object [See BackgroundWorker object]
Index
[].NET 2.0MaskedTextBox control [See MaskedTextBox control]SystemSounds class [See SystemSounds class]ToolStrip control [See tool strips]WebBrowser control [See WebBrowser control]XPathDocument class [See XPathDocument class]NET 2.0binding to data without writing code [See data binding]
Index
[]
Index
[]partial classesDefault.aspx
Index
[]
Index
[]
Index
[]security, forms-based [See forms-based security]skinssnippets [See code snippets]Sound Player classsounds [See SystemSounds class]SQLselect statementstructs
Index
[]
Index
[]TableLayoutPanel classTextBox controlauto-complete [See auto-complete text boxes]themestype-safecollectionstypes, assigning null value to [See nullable types]
Index
[]Visual Studio 2005code snippetsconfigurationexportinginteracting with data without ADO.NET [See data-bound controls]managing web applications
Index
[]web applicationsadding roles to ASP.NET accouns [See ASP.NET accounts, adding roles]forms-based security [See forms-based security]managingmaster pages [See master pages]personalized web sites [See personalized web sites]tool strips [See tool strips]
Index
[]XML documents, binding to [See XmlDataSource control]XPathXPathDocument
Index
[]applicationsweb [See web applications]Windows [See Windows applications]ASP.NETforms-based security [See forms-based security]personalization [See personalized web sites]ASP.NET Web Site Administration Tool (WAT)BackgroundWorker object [See BackgroundWorker object]AutoCompleteModeAutoCompleteSource
Index
[]binding data [See data binding]browser [See WebBrowser control]browser events
Index
[]anonymous methods [See anonymous methods]generics [See generics]iterators [See iterators]nullable types [See nullable types]partial types [See partial types]static classes [See static classes]classesLinkedList [See LinkedList class]List [See List class]splitting across files [See partial keyword]static [See static classes]code snippetsComboBox controlauto-complete [See auto-complete text boxes]
Index
[]datainteracting without ADO.NET [See data-bound controls]XML documents [See XmlDataSource control]debuggingDefault.aspx
Index
[]exceptions
Index
[]formsFlowLayoutPanel control [See FlowLayoutPanel control]TableLayoutPanel control [See TableLayoutPanel control]
Index
[]generic classesGeneric namespaceglobal namespacequalifier
Index
[]
Index
[]IISIIS Administratoriterators
Index
[]
Index
[]
Index
[]LinkedList class
Index
[]MaskedTextBoxMaskedTextBox classmethodsanonymous [See anonymous methods]BackgroundWorker object [See BackgroundWorker object]
| Reviews | Reader Reviews | Errata | Academic |
| Visual C# 2005: A Developer's Notebook | By Jesse Liberty | Publisher | : O'Reilly |
---|
Pub Date | : April 2005 |
---|
ISBN | : 0-596-00799-X |
---|
Pages | : 239 |
---|
|
---|
Microsoft's C# language has attracted millions to .NET. Now,to make development on this platform quicker and easier, C#2.0 offers some key changes as part of the upcoming VisualStudio 2005. The C# 2.0 beta is already available, and ourunique "all lab, no lecture" guide offers 50 hands-onprojects to explore each new feature. Learn what C# 2.0 cando for you now. |
Index
[].NET 2.0MaskedTextBox control [See MaskedTextBox control]SystemSounds class [See SystemSounds class]ToolStrip control [See tool strips]WebBrowser control [See WebBrowser control]XPathDocument class [See XPathDocument class]NET 2.0binding to data without writing code [See data binding]
Index
[]
Index
[]partial classesDefault.aspx
Index
[]
Index
[]
Index
[]security, forms-based [See forms-based security]skinssnippets [See code snippets]Sound Player classsounds [See SystemSounds class]SQLselect statementstructs
Index
[]
Index
[]TableLayoutPanel classTextBox controlauto-complete [See auto-complete text boxes]themestype-safecollectionstypes, assigning null value to [See nullable types]
Index
[]Visual Studio 2005code snippetsconfigurationexportinginteracting with data without ADO.NET [See data-bound controls]managing web applications
1.10. Access Objects in the Global Namespace
As in previous versions of C#, the namespace keyword is used to declare a scope. Thislets you organize your code and prevents identifier collisions (forexample, two different classes with the same name), especially whenusing third-party components.
Any object that is not defined within a specific namespace is in theglobal namespace. Objects in the global namespace are available to objectsin any other namespace. If a name collision occurs, however, you willneed a way to specify that you want the object in the globalnamespace rather than in the local namespace.
Note: The global namespace qualifier allows you to specify anidentifier in the (default) global namespace rather than in the localnamespace .
1.10.1. How do I do that?
To access objects in the global namespace, you use the new globalnamespace qualifier ( global: :), as shown in .
Example 1-8. Using the global namespace
using System; namespace GlobalNameSpace{ class Program { // create a nested System class that will provide // a set of utilities for interacting with the // underlying system (conflicts with System namespace) public class System { } static void Main(string[ ] args) { // flag indicates if we're in a console app // conflicts with Console in System namespace bool Console = true; int x = 5; // Console.WriteLine(x); // won't compile - conflict with Console // System.Console.WriteLine(x); // conflicts with System global::System.Console.WriteLine(x); // works great. global::System.Console.WriteLine(Console); } }}