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

Class across multiple files

Jay
Is it possible to split a class up in multiple files? if so how?
Nov 17 '05 #1
4 2084
Jay wrote:

Is it possible to split a class up in multiple files? if so how?


You can, in C# 2.0. Just add the "partial" modifier before each
"class" keyword. Only one partial class has to have the access and
scope modifiers ("public abstract" and the like); if more than one
than one does, all must agree.

--

www.midnightbeach.com
Nov 17 '05 #2
What was the primary reason for allowing a class to be split across
multiple files? Was it to allow multiple develpers to work on it
simultaneously?

Johann Blake

Nov 17 '05 #3
Jay
the primary reason is just to have smaller source code files that are easier
to maintain.

"Johann Blake" wrote:
What was the primary reason for allowing a class to be split across
multiple files? Was it to allow multiple develpers to work on it
simultaneously?

Johann Blake

Nov 17 '05 #4
Johann Blake wrote:
What was the primary reason for allowing a class to be split across
multiple files? Was it to allow multiple develpers to work on it
simultaneously?


As I understand it, the primary driver was keeping designer-maintained
code (the InitializeComponent method) separate from user-maintained
code (the event handlers and the like).

While we can use it to have Your Part of the class and My Part of the
class, or for versioning (the Silver SKU overrides fewer methods than
the Gold SKU), neither was the intended use, and I've seen ANY manual
use disparaged.

--

www.midnightbeach.com
Nov 17 '05 #5

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

Similar topics

9
by: Steven T. Hatton | last post by:
It was once suggested to me that I could accomplish much the same thing that modules would accomplish (if C++ had modules) by writing my entire program - except for main() - inside of a class. ...
18
by: Bradley | last post by:
I'm trying to determine if there's a general rule for when an Interface should used vs. an Abstract Class. Is there any design advantage to using one or the other? Brad
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.
11
by: Kimmo Laine | last post by:
I'm flipping my wig here, people. I'm using classes and making each class a file. when I'm including dependet classess, I use require_once to avoid multiple declarations - yet they happen. I put...
9
by: ThazKool | last post by:
I am just wondering if all the methods that are never called upon during a programs execution are removed when optimizing. For example you have: class FooA { void a(); ... void z(); }
6
by: Orgun | last post by:
Hi, I sent this message to the moderated c++ group too but it is waiting for moderator approval and I wanted to send here too. I am new to Design Patterns. I want to write a simple...
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,...
5
by: D_a_n_i_e_l | last post by:
Is it possible to split a class definition over two files? Thanks.
5
by: Damodhar | last post by:
When would you use an abstract class and when an interface? whats the abstract class.? please give me the sample .
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
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
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.