namespaces

C# using namespace directive in nested namespaces

Right, I've usually used 'using' directives as follows using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AwesomeLib { //awesome award winning class declarations making use of Linq } i've recently seen examples of such as using System; using System.Collections.Generic; using System.Lin...

Is it possible to distinguish types with identical fully qualified names?

The scenario is I would like to be able reference two similar 3rd party assemblies (e.g. assem1 and assem2) which both define a type with the same fully qualified name (e.g. Example.MyType). Is there any way to distinguish between these and refernce them seperately? I believe the answer is no but confirmation or correction would be handy...

What should the assembly names be for an application providing both a GUI and command-line interface?

I've written a few desktop applications in .NET that provide both a front-end GUI for normal use as well as a command-line interface for other needs (e.g. extending, scheduling, automating, advanced usage, etc). What is the best practice for naming the two executables, since they are built to the same directory? I've seen or done some of...

Problem with WCF and multiple namespaces - sharing object types across multiple service references

Hi, i have two web services. One with user functionality, one with admin functionality. Both services effectively work with the same object types, for instance: AdminService provides functionality for deleting/modifying Customer objects UserService provides functionality for listing/reading Customer objects Now in the client i have...

How can I access attributes and elements from XML::LibXML in Perl?

I am having trouble understanding / using name spaces with XML::LibXML package in Perl. I can access an element successfully but not an attribute. I have the following code which accesses an XML file (http://pastebin.com/f3fb9d1d0). my $tree = $parser->parse_file($file); # parses the file contents into the new libXML object. my $xpc =...

'CompanyName.Foo' is a 'namespace' but is used like a 'type'

Restatement of the question I'm resurrecting this question because I just ran into this error again today, and I'm still utterly confused why the C# compiler bothers to check for collisions between namespaces and types in contexts where it makes no sense for a namespace to exist. If I have... public Foo MyFoo { get; set; } ...why wo...

jquery selecting a selector with namespaced element

how would i select the following in jquery <ns:text value="my value" /> i have tried selecting it like so: 1: var x= $('ns:text').attr('value'); return x; 2: var x= $('text').attr('value'); return x; but nothing so far... i don't know if it is possible or not but ... Thanks ...

XSL: Ignoring/stripping namespaces in secondary documents

I am writing an XSL template that pulls data from many secondary sources. An example secondary document looks like this: <toplevel xmlns:foo1="http://foo1"&gt; <path xmlns="http://foo1"&gt; <mytag>bar</mytag> </path> </toplevel> In the XSL, I am doing this: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Tr...

Why can't I forward-declare a class in a namespace like this?

class Namespace::Class; Why do I have to do this?: namespace Namespace { class Class; } Using VC++ 8.0, the compiler issues: error C2653: 'Namespace' : is not a class or namespace name I assume that the problem here is that the compiler cannot tell whether Namespace is a class or a namespace? But why does this matter sinc...

What are the consequences of having (too) many namespaces?

I run code analysis on a project and I get a warning saying CA1020 : Microsoft.Design : Consider merging the types defined in {some namespace} with another namespace. {some namespace} Why do I get this? Is there a negative implication of having too many namespaces? ...

C++/VS2005: Defining the same class name in two different .cpp files

Somewhat of an academic question, but I ran into this while writing some unit tests. My unit test framework (UnitTest++) allows you to create structs to serve as fixtures. Usually these are customized to the tests in the file, so I put them at the top of my unit test file. //Tests1.cpp struct MyFixture { MyFixture() { ... do some se...

When working with web.config, Configuration class is not available

I want to access the "appSettings" section of a web.config file. According to MSDN and multiple other sources, the following should work: System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration("/rootPath"); I received this error on the second configuration (System.Configuration.Configuration): ...

rails nested object form and namespaced controller

i have a nested object like this: class Work < ActiveRecord::Base belongs_to :issue belongs_to :author has_many :pages, :class_name => 'Work' accepts_nested_attributes_for :pages, :allow_destroy => true end class Page < ActiveRecord::Base belongs_to :work end and i have a form to create/edit a work, with fields for the nest...

Importing name space withouth use , effect performance ?

Hi all Is there any deficiency performance if import a lot of name space in Web.config or in every single cs file while it's not necessary to be in all classes ? Thank you ...

Namespace and Assembly names for a reusable component

Hi everyone! I've got a bit of a conundrum on my hands. I'm currently compiling a load of 'code snippets' into reusable libraries that I obviously intend to use in multiple applications. I'm having trouble deciding on an appropriate namespace and assembly name. Basically, I've currently got JasonSummers.Validation as an example for m...

C++ namespaces - "using" or explicitly stated?

Possible Duplicates: Why is using namespace std; considered a bad practice in C++? Using std Namespace Is it just a matter of preference? Or is there a valid reason for preferring using namespace std; #include <string> myString string; or #include <string> myString std::string; I suppose that explicitly stating the name...

What to do with private member functions when turning static class to namespace in C++?

I have a class that has 5 static public functions and 1 static private function (called from one of the public functions). The class doesn't have any member variables. It seems to me that it should be a namespace and not a class. But what to do with the private function? I prefer it not to be accessible by every namespace user, but there...

Hiding private constants in an inline namespace header

I have some inline functions contained within a namespace in a header file and am not currently in a position to move them into a cpp file. Some of these inline functions use magic constants, for example: // Foo.h namespace Foo { const int BAR = 1234; inline void someFunc() { // Do something with BAR } } Howe...

How to declare a namespace in WPF XAML?

I am trying to use in WPF a validating input of databound controls with validation rules. In the code behind file of a wpf window I have a class: public class posintValidationRule : ValidationRule { public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo) { ...

Fine to have variables in a namespace?

I have a set of functions that work on a file. Originally I made it into a class, with the only private member being a static const std::string which was the name of the file. The user used these functions by creating an object and calling functions from it. However, I think I'm going to switch to using a namespace, since it's just a set...