tagged [namespaces]

What is the benefit of using namespace aliases in C#?

What is the benefit of using namespace aliases in C#? What is the benefit of using namespace aliases? Is it good only for simplify of coding?

24 Feb at 10:8

How do you resolve the common naming collision between type and object?

How do you resolve the common naming collision between type and object? Since the standard c# convention is to capitalize the first letter of public properties, the old c++ convention of initial capit...

How to name multiple versioned ServiceContracts in the same WCF service?

How to name multiple versioned ServiceContracts in the same WCF service? When you have to introduce a breaking change in a ServiceContract, a best practice is to keep the old one and create a new one,...

How do I use XPath with a default namespace with no prefix?

How do I use XPath with a default namespace with no prefix? What is the XPath (in C# API to XDocument.XPathSelectElements(xpath, nsman) if it matters) to query all MyNodes from this document? - `/conf...

27 Mar at 16:42

Way to get VS 2008 to stop forcing indentation on namespaces?

Way to get VS 2008 to stop forcing indentation on namespaces? I've never really been a big fan of the way most editors handle namespaces. They always force you to add an extra level of indentation. Fo...

explicitly refer to a class without a namespace in C#

explicitly refer to a class without a namespace in C# The code I'm working with has a class called that is not in any namespace. Unfortunately if I am in a class that imports the namespace, there is n...

4 May at 18:41

Namespace constant in C#

Namespace constant in C# Is there any way to define a constant for an entire namespace, rather than just within a class? For example: Gives a compile error as follows: Expected class, delegate, enum, ...

12 May at 14:46

C#: Problem trying to resolve a class when two namespaces are similar

C#: Problem trying to resolve a class when two namespaces are similar I'm running into an issue where I can't make a reference to a class in a different namespace. I have 2 classes: ``` namespace Foo ...

26 May at 16:12

Class with same name in two assemblies (intentionally)

Class with same name in two assemblies (intentionally) I'm in the process of migrating a library that is written in C++ and has a C# wrapper. The C# wrapper (`LibWrapper`) has a set of classes with na...

10 Jun at 20:52

C#: Can you split a namespace across multiple files?

C#: Can you split a namespace across multiple files? Well I couldn't find any previous posting to answer my question so.... I am new to C# and creating some Windows Forms and noticed that it created a...

22 Jun at 14:4

C#: Use a namespace for a specific block of code?

C#: Use a namespace for a specific block of code? I just have a point of curiosity. I'm working with SSRS and calling its SOAP methods. I've got stubs generated / Web references created and that's all...

29 Jun at 19:42

EF4 Poco Issue Mapping Types Same Name Same Assembly Different Namespaces

EF4 Poco Issue Mapping Types Same Name Same Assembly Different Namespaces I am experiencing an issue with and . I have 2 classes with the same name in the same assembly but : This compiles fine but at...

28 Jul at 14:56

basic question on C# - do I need a namespace?

basic question on C# - do I need a namespace? I am a Java developer, totally new to C#. I am currently writing a DLL for distribution across my organization. It is a very simple library containing a c...

20 Sep at 10:32

Namespaces in C# vs imports in Java and Python

Namespaces in C# vs imports in Java and Python In the Java and Python world, you look at a source file and know where all the imports come from (i.e. you know in which file the imported classes are de...

22 Sep at 09:46

2 objects, exactly the same (except namespace) c#

2 objects, exactly the same (except namespace) c# I'm using a 3rd party's set of webservices, and I've hit a small snag. Before I manually make a method copying each property from the source to the de...

24 Sep at 15:55

.NET Multiple Namespaces for single class

.NET Multiple Namespaces for single class Is it possible to have a single class reside within two name-spaces and how can I do this? To clarify: We have a class library (let say root namespace is clas...

27 Sep at 15:46

How to Select XML Nodes with XML Namespaces from an XmlDocument?

How to Select XML Nodes with XML Namespaces from an XmlDocument? my code attempts to grab data from the RSS feed of a website. It grabs the nodes fine, but when attempting to grab the data from a node...

8 Jan at 16:3

Extension methods conflict

Extension methods conflict Lets say I have 2 extension methods to string, in 2 different namespaces: ``` namespace test1 { public static class MyExtensions { public static int TestMethod(this...

Is there a way to get all namespaces you're 'using' within a class through C# code?

Is there a way to get all namespaces you're 'using' within a class through C# code? Is there any way to get a `List` which contains all 'usings' within a namespace/class? For instance ``` using System...

29 Apr at 01:36

Use of Namespaces in C#

Use of Namespaces in C# I was wondering, what the purpose of Namespaces in C# and other programming languages is... As far as I know, they are used for two things: - - My Question is: Are there any ot...

6 May at 17:41

(Question on best practice) Why is "using System.Text" there by default?

(Question on best practice) Why is "using System.Text" there by default? Every time I creat a class, I see `using System.Text` that is added (amongst other `using`) by default. Every time I remove it ...

Can I import a static class as a namespace to call its methods without specifying the class name in C#?

Can I import a static class as a namespace to call its methods without specifying the class name in C#? I make extensive use of member functions of one specific static class. Specifying the class name...

12 Jun at 00:33

Reference added but Namespace is not recognized

Reference added but Namespace is not recognized I added a DLL to my project. The DLL contains the namespace `test.security`. Now, test.security is not recognized. Why is this? I am using this DLL in o...

16 Jul at 07:24

Can i name a C# namespace starting with a number?

Can i name a C# namespace starting with a number? I'm on a Mac and can't try it for myself right now. For example, will this compile:

2 Aug at 21:57

Definition of enums outside the class body but inside namespace

Definition of enums outside the class body but inside namespace Today, I ran into some code that goes like this. I could not figure out what the difference between that and declaring the enums inside ...

19 Sep at 00:3