How to separete a class in more than one source file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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

Thanks.
 
[Please fix your newsreader to wrap lines properly.]

=?Utf-8?B?SnVhcmV6?= said:
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.
 
Juarez said:
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
 
Jon Skeet said:
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
 
Chad Z. Hower aka Kudzu said:
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 said:
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
 
Chad Z. Hower aka Kudzu said:
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.
 
Back
Top