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...
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...
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...
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...
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 =...
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...
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
...
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">
<path xmlns="http://foo1">
<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...
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...
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?
...
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...
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):
...
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...
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
...
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...
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...
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...
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...
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)
{
...
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...