Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Namespace not found
Message
De
18/08/2005 17:44:59
 
 
À
18/08/2005 12:44:59
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01042013
Message ID:
01042100
Vues:
17
This message has been marked as a message which has helped to the initial question of the thread.
Hilmar,

As Alan and Perry both said, you need to add the reference ... that's the "required" part, the "using" isn't actually required. That's because you can instantiate classes from that namespace without using a "Using" statement. The "Using" statement makes it easier to use "short-hand" when coding.

As an example, say your main application namespace is "MyCompany" and you have "child" namespaces of MyCompany.Business, MyCompany.DataAccess, MyCompany.DataSets, etc. etc.

As long as a reference to MyCompany.DataSets has been added to your project, you can fully qualify the namespace in code without having to add a "Using" statement:
    MyCompany.DataSets.MyCustomerDataSet oData = new MyCompany.DataSets.MyCustomerDataSet();
but, by the use of a "Using" statement, you can make things a lot more readable:
using MyCompany.DataSets;

...
...

    MyCustomerDataSet oData = new MyCustomerDataSet();
~~Bonnie




>I have two projects in one solution. Files in one project use one namespace, in another project, another namespace.
>
>In one of the projects, I want to use a class from the other project. I put:
>
>
>using MySession // the namespace from the other project
>...
>
>
>and in this line, the compiler complains that the namespace can't be found. (I copied and pasted the namespace, to make sure it wasn't a spelling error.)
>
>What am I missing?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform