partial namespace

S

Steph

hello,
can we do a partial namespace ?
i want split my cs file (contain all my classes) in a lot of files and then
compil their into my DLL...
so in this case, is more easy to work :

library.dll =
library.net.cs
library.fileio.cs
library.xml.cs
library.img_manipulation.cs
etc ...


thx

S.
 
J

jan.hancic

There is no requierment that all types that belong to a namespace must
be in the same file.

And I think you are missing something there. If you wan't to compile
everything into one DLL then make a Class library proejct put your
files there compile and you will get your DLL.
 
J

Joanna Carter [TeamB]

"Steph" <[email protected]> a écrit dans le message de [email protected]...

| can we do a partial namespace ?

Namespaces can span more than one module (.cs file)

| i want split my cs file (contain all my classes) in a lot of files and
then
| compil their into my DLL...

Best practice is to only have one class per module unless the classes are
intimately related.

// net.cs
namespace YourCompany.YourProject.Library
{
...
}

// fileio.cs
namespace YourCompany.YourProject.Library
{
...
}

// xml.cs
namespace YourCompany.YourProject.Library
{
...
}

// img_manipulation.cs
namespace YourCompany.YourProject.Library
{
...
}

Joanna
 
S

Steph

Joanna Carter said:
"Steph" <[email protected]> a écrit dans le message de [email protected]...

| can we do a partial namespace ?

Namespaces can span more than one module (.cs file)

| i want split my cs file (contain all my classes) in a lot of files and
then
| compil their into my DLL...

Best practice is to only have one class per module unless the classes are
intimately related.

// net.cs
namespace YourCompany.YourProject.Library
{
...
}

// fileio.cs
namespace YourCompany.YourProject.Library
{
...
}

// xml.cs
namespace YourCompany.YourProject.Library
{
...
}

// img_manipulation.cs
namespace YourCompany.YourProject.Library
{
...
}

hum... yes... i m missing something...
so i can do :
csc /target:library /out:mylibrary.dll xml.cs fileio.cs net.cs etc...
?
i m really miss something ;-)
 
S

Steph

no work...
i create two .cs file :
"net.cs" with :
namespace myTest
{
public class netTest {
//...
}
}

and a "xml.cs" with :
namespace myTest
{
public class xmlTest {
//...
}
}
then i compil :

csc /target:library /out:mylibrary.dll xml.cs net.cs

but... in my "mylibrary.dll" i v not my "xmlTest" class (or "netTest")...

how do ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top