By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,249 Members | 1,665 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,249 IT Pros & Developers. It's quick & easy.

Partial Classes across different namespaces ?

P: n/a
Hi,

Is there a way to have partial classes across different namespaces ?

namespace a.b.c
{
public partial class X
{
private void MyMethod () { }
}
}
using a.b.c

namespace a.b.c.d
{
public partial class X
{

}
}

Now , when the MyMethod has to be used in the second partial class ,
the compiler fails to recognize it. Where am i going wrong ?

thanks in advance ..

Oct 15 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
vivekian wrote:
Hi,

Is there a way to have partial classes across different namespaces ?

namespace a.b.c
{
public partial class X
{
private void MyMethod () { }
}
}
using a.b.c

namespace a.b.c.d
{
public partial class X
{

}
}

Now , when the MyMethod has to be used in the second partial class ,
the compiler fails to recognize it. Where am i going wrong ?
a.b.c.X and a.b.c.d.X are two completely separate, unrelated classes, and
there's no way to make them act like the same class.

-cd
Oct 15 '06 #2

P: n/a
vivekian wrote:
Hi,

Is there a way to have partial classes across different namespaces ?

namespace a.b.c
{
public partial class X
{
private void MyMethod () { }
}
}
using a.b.c

namespace a.b.c.d
{
public partial class X
{

}
}

Now , when the MyMethod has to be used in the second partial class ,
the compiler fails to recognize it. Where am i going wrong ?

thanks in advance ..
Hi,
Is there a way to have partial classes across different namespaces ?
No, there isn't because this doesn't make sense. A namespace seperates
types from each other, so that you can A) provide a logical seperation
between types and B) have types of the same name.

May I ask why would you need to have a partial class in two seperate
namespaces?

--
Hope this helps,
Tom Spink

Google first, ask later.
Oct 15 '06 #3

P: n/a
Hi,

"vivekian" <vi********@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hi,

Is there a way to have partial classes across different namespaces ?
If ypu have two classes under a different namespace they are different.
--
Ignacio Machin
machin AT laceupsolutions.com
Oct 16 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.