473,738 Members | 2,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Class across multiple files

Jay
Is it possible to split a class up in multiple files? if so how?
Nov 17 '05 #1
4 2103
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 InitializeCompo nent 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
2451
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. When it was suggested, I didn't take it very seriously, but I have recently begun wondering if it is an idea worth considering. I'm now trying to think of what fundamental differences might exist between namespace scope, and class scope. One that...
18
3781
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
2648
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
41092
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 debug_print_backtrace in the file to see how it is included, and here's the output: #0 require_once() called at #1 require_once(\eKirje.textGrid.class.php) called at #0 require_once() called at #1 require_once(\eKirje.kanava.class.php)...
9
3190
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
2078
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 DeviceManager which is only interested in CD/DVD devices. I want to get the list of CD/DVD devices and "be informed when a disc inserted into a device". I am developing this on Linux. So, I used HAL API and read some system (actually /proc) files to gather...
3
1976
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, how can I create partial classes to handle this situation OR if I create new class files in App_Code folder to handle major code of ASPX code behind page then how can I get the access to the various Web Control which I have created on the ASPX...
5
5208
by: D_a_n_i_e_l | last post by:
Is it possible to split a class definition over two files? Thanks.
5
12819
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
8968
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8787
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9473
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9334
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8208
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6750
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4824
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.