473,657 Members | 2,524 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What is the default NameSpace

ad
Hi,
If I did not include a class in a NameSpace.
What is the default NameSpace of that class
Nov 17 '05 #1
1 1352
Hi ad,
if you do not create a namespace inside a class it is included in the
global namespace and can be referenced without any name space information i.e.

namespace MyNewNameSpace
{
class Program
{
static void Main(string[] args)
{
//No namespace information required.
GlobalNameSpace Class c1 = new GlobalNameSpace Class();
}
}
}
//Not inside a namespace
class GlobalNameSpace Class
{
public GlobalNameSpace Class()
{
}
}
I wouldn't recommend doing this though as namespaces help to avoid conflicts
between identically named classes.

Hope that helps
Mark R Dawson
http://www.markdawson.org
"ad" wrote:
Hi,
If I did not include a class in a NameSpace.
What is the default NameSpace of that class

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2932
by: Lénaïc Huard | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I've some namespace problems when defining default values for attributes. My problem seems to come from the fact that the attributes are defined in a different namespace from the element.
5
4388
by: Steve Jorgensen | last post by:
I was having a bear of a time today trying to figure out some inconsistent behavior selecting nodes from and MSXML DOM document, so I distilled the issue down to a trivial test demonstrating the confusing behavior. The deal is that I want to create most of my XML nodes from code using createNode, but the code is much more clear if I can start by building the basic skeleton of the document using a simple XML string. The catch is, I'll...
5
4070
by: Adam Child | last post by:
Hi All, I'm trying to validate an xml document. I'm having trouble setting the default namespace of the xml document. If I hard encode the namespace in the xml file then everything works fine. But I can't do this because it breaks our old tools which validate the xml to a dtd (error saying the dtd doens't allow xmlns attribute on the root element). So I'm trying to add the default namespace to the xml file by code. As follows:
5
2398
by: David Thielen | last post by:
Hi; I set up my xml as follows: XmlDocument xml = new XmlDocument(); xml.Load(File.Open("data.xml", FileMode.Open, FileAccess.Read)); XmlNamespaceManager context = new XmlNamespaceManager(xml.NameTable); context.AddNamespace("", "http://www.test.org"); context.AddNamespace("sns", "http://www.test.org/sub"); XmlNode node = xml.SelectSingleNode("/root", context);
9
2219
by: Patty O'Dors | last post by:
Hi Can somebody please tell me what namespaces are actually for? I notice that when I start a new project in C#, it puts everything in a namespace of the same name as the project. I found them a bit annoying as when I save a class's .cs file to my 'generic code' folder, and then put it in another project, I have to manually go and change the namespace name. This I find a bit of a PITA. I used VB.NET for a bit and found it didn't have...
12
8554
by: Plop69 | last post by:
need some help on following: xml file 1 <TEST xmlns="http://test" > <OK>mlkddflmkj</OK> </TEST>
2
1414
by: Max | last post by:
Hello everyone! I have 2 questions: - Is the default-default namespace "http://www.w3.org/2000/xmlns/" or an empty string("")? - Is the localname property for element without prefix the name of element (localName = nodeName) or an empty string("")? Thanks,
7
1842
by: Bilal | last post by:
Hello all, I came across this problem while working out the bugs in my identity trasnformation stylesheets but sidestepped it for later to see if there is an easier/better solution. This is essentially following up to my last post so apologies for repeating parts of the post. The transformation stylesheet is (after corrections from kind contributors :) <?xml version="1.0" encoding="UTF-8"?>
9
6471
by: Mark Olbert | last post by:
I'm trying to serialize (using XmlSerializer.Serialize) a class that I generated from an XSD schema using XSD.EXE /c. The problem I'm running into is that the root element needs to be unqualified, and the default namespace needs to be included on it as an attribute. The schema I'm using is this: <xs:schema xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:html="http://www.w3.org/TR/REC-html40"...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7352
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.