473,406 Members | 2,867 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,406 software developers and data experts.

How to separete a class in more than one source file

Is it possible to divide a class in many .cs files ? For example one source file for each method ?

Thanks.

Nov 22 '05 #1
9 1474
[Please fix your newsreader to wrap lines properly.]

=?Utf-8?B?SnVhcmV6?= <an*******@discussions.microsoft.com> wrote:
Is it possible to divide a class in many .cs files ?
For example one source file for each method ?


Not yet, but that's a feature which will appear in Whidbey, under the
name "partial types". It's primarily so that you can split
autogenerated code (e.g. forms designer stuff) from manually generated
code.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 22 '05 #2
[Please fix your newsreader to wrap lines properly.]

=?Utf-8?B?SnVhcmV6?= <an*******@discussions.microsoft.com> wrote:
Is it possible to divide a class in many .cs files ?
For example one source file for each method ?


Not yet, but that's a feature which will appear in Whidbey, under the
name "partial types". It's primarily so that you can split
autogenerated code (e.g. forms designer stuff) from manually generated
code.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 22 '05 #3
Juarez <an*******@discussions.microsoft.com> writes:
Is it possible to divide a class in many .cs files ? For example one
source file for each method ?


Now you can't, but when with the Whidbey release of the framework
we'll have partial types you'll be able to do that.

Bye

--
Lawrence "Rhymes" Oluyede
http://loluyede.blogspot.com
Nov 22 '05 #4
Juarez <an*******@discussions.microsoft.com> writes:
Is it possible to divide a class in many .cs files ? For example one
source file for each method ?


Now you can't, but when with the Whidbey release of the framework
we'll have partial types you'll be able to do that.

Bye

--
Lawrence "Rhymes" Oluyede
http://loluyede.blogspot.com
Nov 22 '05 #5
Juarez,
In addition to the others comments: when I need to do this, I consider using
the Replace Method with Method Object refactoring.

http://www.refactoring.com/catalog/r...hodObject.html

Granted you wind up with 2 classes...

Hope this helps
Jay

"Juarez" <an*******@discussions.microsoft.com> wrote in message
news:29**********************************@microsof t.com...
Is it possible to divide a class in many .cs files ? For example one source file for each method ?
Thanks.

Nov 22 '05 #6
Jon Skeet [C# MVP] <sk***@pobox.com> wrote in
news:MP************************@msnews.microsoft.c om:
Not yet, but that's a feature which will appear in Whidbey, under the
name "partial types". It's primarily so that you can split
autogenerated code (e.g. forms designer stuff) from manually generated
code.


Why did they need to implement that to do that? Couldnt they just build a
base class which the designer code goes in and then we as users work in the
descendant?
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Nov 22 '05 #7
Chad Z. Hower aka Kudzu <cp**@hower.org> wrote:
Jon Skeet [C# MVP] <sk***@pobox.com> wrote in
news:MP************************@msnews.microsoft.c om:
Not yet, but that's a feature which will appear in Whidbey, under the
name "partial types". It's primarily so that you can split
autogenerated code (e.g. forms designer stuff) from manually generated
code.


Why did they need to implement that to do that? Couldnt they just build a
base class which the designer code goes in and then we as users work in the
descendant?


That would be solving a tools problem with a design solution - and the
two should (IMO) rarely mix. If a tool deficiency forces you to make a
suboptimal design (such as having two levels of hierarchy when you
really only want one) then there's something wrong.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 22 '05 #8
Jon Skeet [C# MVP] <sk***@pobox.com> wrote in
news:MP************************@msnews.microsoft.c om:
That would be solving a tools problem with a design solution - and the
two should (IMO) rarely mix. If a tool deficiency forces you to make a
suboptimal design (such as having two levels of hierarchy when you
really only want one) then there's something wrong.


Thats quite a fine line - but I dont see how splitting a class into two files
AND modifying the language to fix a "Tools problem" is better.

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com

Nov 22 '05 #9
Chad Z. Hower aka Kudzu <cp**@hower.org> wrote:
Jon Skeet [C# MVP] <sk***@pobox.com> wrote in
news:MP************************@msnews.microsoft.c om:
That would be solving a tools problem with a design solution - and the
two should (IMO) rarely mix. If a tool deficiency forces you to make a
suboptimal design (such as having two levels of hierarchy when you
really only want one) then there's something wrong.


Thats quite a fine line - but I dont see how splitting a class into two files
AND modifying the language to fix a "Tools problem" is better.


It's better because instead of solving one specific problem, it solves
a range of problems - wherever there's autogenerated code, it's
appropriate. It also keeps the end class design the same, just giving
the option of a slightly less conventional implementation.

I agree it's a fairly fine line, but I know I'd hate to have to have
hierarchies which were too deep just for the sake of the designer.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 22 '05 #10

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

Similar topics

19
by: Dave | last post by:
Hi, I have done some research, trying to Clear The Screen in java code. The first option was the obv: system.out.print("\n\n\n\n\n\n\n\n\n\n\n\n"); then i heard about this method:...
7
by: Juarez | last post by:
Is it possible to divide a class in many .cs files ? For example one source file for each method ? Thanks.
4
by: mchoya | last post by:
I'm so frustrated. I'm beginning school next week and I have been working on a simple program for several days now without being able to complete it. (Though I have brushed up on a lot of C++...
2
by: Matt | last post by:
Hello, I would like to generate what I call an "overall class hierarchy" in UML automatically derived from my C++ code source. An example of what I seek: ...
7
by: A_StClaire_ | last post by:
hi, I'm working on a project spanning five .cpp files. each file was used to define a class. the first has my Main and an #include for each of the other files. problem is my third file...
10
by: Not Available | last post by:
On the host server: namespace JCart.Common public class JCartConfiguration : IConfigurationSectionHandler private static String dbConnectionString; public static String ConnectionString { get...
8
by: tshad | last post by:
I cannot seem to get the asp:textbox to use classes. Style works fine. I am trying to set the textbox to act like a label in some instance so it doesn't have a border, readonly and the background...
20
by: Scott M. | last post by:
What are the advantages of defining a class as part of another class definition (nesting classes)?
15
by: akomiakov | last post by:
Is there a technical reason why one can't initialize a cost static non- integral data member in a class?
33
by: Peng Yu | last post by:
Hi, __PRETTY_FUNCTION__ is a macro that gives function name, etc. I'm wondering if there is a macro to get the class name inside a member function. Thanks, Peng
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.