473,394 Members | 1,702 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,394 software developers and data experts.

About partial class

A few quick questions:

Is there a limitation on how much partial class files we can have for a
single class? And can a ASP.NET page file inherit a class from multiple
code-behind files? if so, do I need to point out all the codefiles in the
page directive, or just one of them is enough?
Aug 18 '06 #1
3 2558
You are asking this question leads me to wonder if you are dealing with a
design problem.

Perhaps you could give more detail on why you need many partial classes?

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung

"Lau Lei Cheong" <le****@yehoo.com.hkwrote in message
news:ev**************@TK2MSFTNGP02.phx.gbl...
>A few quick questions:

Is there a limitation on how much partial class files we can have for a
single class? And can a ASP.NET page file inherit a class from multiple
code-behind files? if so, do I need to point out all the codefiles in the
page directive, or just one of them is enough?

Aug 18 '06 #2
Greg Young wrote:
You are asking this question leads me to wonder if you are dealing with a
design problem.

Perhaps you could give more detail on why you need many partial classes?

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung

"Lau Lei Cheong" <le****@yehoo.com.hkwrote in message
news:ev**************@TK2MSFTNGP02.phx.gbl...
>A few quick questions:

Is there a limitation on how much partial class files we can have for a
single class? And can a ASP.NET page file inherit a class from multiple
code-behind files? if so, do I need to point out all the codefiles in the
page directive, or just one of them is enough?


Hello:

I do not have experience in using partial class in ASP.NET webpage.
However, I have used partial class in ASP.NET web service (*.asmx).

I will assume that the ASP.NET webpage has the same effect in ASP.NET
web service.

It is OK to use partial class in ASP.NET web service.
>"do I need to point out all the codefiles in the
page directive, or just one of them is enough?"
In my experience in ASP.NET web service, it is not necessary to point
out all the codefiles in the WebService directive.
In my experience, I have one "service.asmx" and two codebehind files
"service.asmx.cs" and "service2.cs". Just the "service.asmx.cs" is in
the WebService directive in "service.asmx". "service.asmx.cs" is the
original file which was created by VS2005 and it has the webservice
attributes.
I use partial class because I want to group the testing functions in one
partial class. The testing functions are for list all the row data in
every tables in database. I can simplely remove the whole partial class
file to remove all testing functions.
P.S. I use VS2005 with the Web application project addin.
--
Jacky Kwok
jacky@alumni_DOT_cuhk_DOT_edu_DOT_hk
jacky@compose_DOT_com_DOT_hk
Aug 18 '06 #3
Hi,
"Lau Lei Cheong" <le****@yehoo.com.hkwrote in message
news:ev**************@TK2MSFTNGP02.phx.gbl...
>A few quick questions:

Is there a limitation on how much partial class files we can have for a
single class?
Yes, AFAIK there is no limitation of how many files can contain a single
class, remember that the compiler just join all them together at compiler
time.
And can a ASP.NET page file inherit a class from multiple code-behind
files?
there is an error there, the asp.net page inherit from a class, not from a
codebehind file. as so it can inherit from only one class.
if so, do I need to point out all the codefiles in the
page directive, or just one of them is enough?
IIRC CodeBehind is deprecated in 2.0.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Aug 18 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: BekTek | last post by:
I'm still confused about the template partial specialization which is used in many libraries.. due to lack of introduction for beginner.. Could you tell me about that in short? Thanks in...
9
by: Gomaw Beoyr | last post by:
Two question about the "partial classes" (in the next wersion of ..NET). Question 1 ========== Will partial classes (in the next version of C#) have to be declared "partial" in ALL places. ...
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...
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...
9
by: Fat Elvis | last post by:
I'd like to extend some of my Asp.net pages by using Partial Classes. Example ASP.Net Page: public partial class Admin_Customer : System.Web.UI.Page { protected void Page_Load(object sender,...
3
by: erich | last post by:
In VS2005, creating a new form creates the form class and a partial (frm*.designer.vb) class file and displays the partial class beneath the main form frm*.vb, which is great. However, when...
2
by: Hiten | last post by:
Is it possible to have more code behind file but that file will have same class in way of partial class, Default Structure I -------------- Homepage.aspx + Homepage.aspx.cs (this .cs file...
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...
1
by: Stephanie | last post by:
Hi. I am doing a tutorial http://www.15seconds.com/Issue/020319.htm About creating user controls in ASP.NET. As I run through the tutorial, there is a point after which I create a lovely...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.