473,387 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Partial Classes across different namespaces ?

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
3 5418
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: pawel.pabich | last post by:
Hajo, I would like to have 2 my own partial classes. For example: Default.aspx.cs Default2.aspx.cs and they both will relate to Default.aspx page.
10
by: ptass | last post by:
Hi In asp.net 2.0 an aspx files .cs file is a partial class and all works fine, however, I thought I’d be able to create another class file, call it a partial class and have that compile and...
0
by: rcolby | last post by:
Hi, A little advice on code sharing across projects, namespaces and dll's for references. I've got an application that is split between three different projects (one for a service, one for...
1
by: Bishoy George | last post by:
In a web application using asp.net 2.0 All my classes are partial classes. - I noticed that partial class cannot be inherited... is that true? - I tried to remove the partial keyword , and I...
0
by: John Mott | last post by:
Hello all, I'm trying to break up a large CodeFile .cs file into multiple pieces using partial classes. I'm getting compiler errors which act as if it didn't merge the multiple files. in...
3
by: Aryan | last post by:
Hi, I have problem in creating Partial Class for ASPX pages. As my Codebase file for ASPX page is having more then 2500 lines of code. So its very hard to maintain the code. So I wanted to know,...
7
by: Adrian Hawryluk | last post by:
Can one define a partial class (first part containing constants like enums) and then define the rest of the class elsewhere? I ask this because I've had in the past needed to defined two classes...
2
by: Peted | last post by:
Hi, im moving a project from vs2005 to vs 2008. is doing so i have come across a compiler error regarding partial classes that i dont understand if anyone can explain it to me please the...
10
by: JDeats | last post by:
So I have a class that spans over two partial classes in code, here's an example (do not read much into this, the code is of no practical use, this is just a simple example of where my confusion...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.