tagged [namespaces]

C# access modifier for exposing class only within namespace

C# access modifier for exposing class only within namespace In java you have package level protection that ensures classes are only usable within the package. Namespaces in C# act more or less like pa...

27 Aug at 14:16

Namespace semantic differences

Namespace semantic differences I see most of the types in `.NET framework` are spread across 3 different namespaces (may be more), one start with `Microsoft`, other with `System` and the third with `W...

25 Sep at 13:53

Why do primitive data types work without including the System namespace?

Why do primitive data types work without including the System namespace? I read that all primitives fall under the `System` namespace. If I comment out `using System` I would expect there to be a buil...

17 Sep at 01:8

Should 'using' directives be inside or outside the namespace in C#?

Should 'using' directives be inside or outside the namespace in C#? I have been running [StyleCop](http://en.wikipedia.org/wiki/StyleCop) over some C# code, and it keeps reporting that my `using` dire...

Parsing XML with namespaces using jQuery $().find

Parsing XML with namespaces using jQuery $().find I'm trying to get the contents of a XML document element, but the element has a colon in it's name. This line works for every element but the ones wit...

24 Mar at 18:42

Ideal number of classes per namespace branch

Ideal number of classes per namespace branch What number of classes do you think is ideal per one namespace "branch"? At which point would one decide to break one namespace into multiple ones? Let's n...

28 Sep at 17:35

namespace naming conventions

namespace naming conventions For those of you out there writing reusable components, what do you consider to be best practice if you're extending the functionality of the .NET framework? For example, ...

How to switch namespace in kubernetes

How to switch namespace in kubernetes Say, I have two namespaces k8s-app1 and k8s-app2 I can list all pods from specific namespace using the below command We need to append namespace to all commands t...

15 Jan at 07:53

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

'namespace' but is used like a 'type'

'namespace' but is used like a 'type' My program uses a class called `Time2`. I have the reference added to `TimeTest` but I keep getting the error, `'Time2' is a 'namespace' but is used like a 'type'...

6 Feb at 07:14

Adding System.Web.Script reference in class library

Adding System.Web.Script reference in class library I am currently moving code from my app_code folder to a class library. I have tagged several methods with `[System.Web.Script.Serialization.ScriptIg...

5 Jun at 19:8

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

ResponseStatus xmlns d2p1

ResponseStatus xmlns d2p1 The question is: how to use one namespace for response, when using `IHasResponseStatus` and `public ResponseStatus ResponseStatus { get; set; }` property, and remove the pref...

VS 2015 - C# simplify/truncate using namespaces

VS 2015 - C# simplify/truncate using namespaces I would prefer the following Visual Studio 2015, does the following I figured out, that I can change the behavior for the code hint (IDE0001) by adjusti...

Taking out all classes of a specific namespace

Taking out all classes of a specific namespace Is there a way to get an object from a specific namespace? Perhaps with the `System.Reflections`? I want to get all objects from type `ITestType` in the ...

19 Jul at 04:33

Visual studio cannot find my referenced DLL's namespace

Visual studio cannot find my referenced DLL's namespace This is a very frustrating problem. All of a sudden I cannot use referenced DLLs. I added an assembly reference to a project in the same solutio...

31 Jul at 18:54

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

This is Sparta, or is it?

This is Sparta, or is it? The following is an interview question. I came up with a solution, but I'm not sure why it works. --- Without modifying the `Sparta` class, write some code that makes `MakeIt...

20 Apr at 20:21

Using Xpath With Default Namespace in C#

Using Xpath With Default Namespace in C# I've got an XML document with a default namespace. I'm using a XPathNavigator to select a set of nodes using Xpath as follows: I am not getting any results ba...

25 Feb at 12:34

What does if __name__ == "__main__": do?

What does if __name__ == "__main__": do? What does this do, and why should one include the `if` statement? --- [Why is Python running my module when I import it, and how do I stop it?](https://stackov...

'SuppressMessage' for a whole namespace

'SuppressMessage' for a whole namespace I use underscores for my test methods for a better readability and I want to suppress FxCop errors/warnings for the whole test namespace. How can I achieve this...

(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 ...

C# - How to check if namespace, class or method exists in C#?

C# - How to check if namespace, class or method exists in C#? I have a C# program, how can I check at runtime if a namespace, class, or method exists? Also, how to instantiate a class by using it's na...

14 Dec at 04:52

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

Can't include Microsoft.Security.Application?

Can't include Microsoft.Security.Application? I can't include Gives this error: > The type or namespace name 'Security' does not exist in the namespace 'Microsoft' (are you missing an assembly referen...