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

What is Parial class ?

What’s the role of Partial keyword which is bydefault written for a class in 2.0 ?

public partial class Form1 : Form

Jun 27 '08 #1
6 1443
OK; just noticed all your other posts... what is this? homework? interview?

Marc
Jun 27 '08 #2
On May 19, 6:27 am, satyanarayan sahoo wrote:
What’s the role of Partial keyword which is bydefault written for a class in 2.0 ?

public partial class Form1 : Form
It's only included by default for classes which have an associated
designer. As Marc says, your questions do sound somewhat like homework
assignments...

(A search for "partial keyword C#" finds plenty of results...)

Jon
Jun 27 '08 #3
"satyanarayan sahoo" wrote in message
news:20*************************@gmail.com...
What’s the role of Partial keyword which is bydefault written for a class
in 2.0 ?

public partial class Form1 : Form
The "partial" keyword applied to a class allows you to split the class
definition accross two or more source files. This was not possible under the
framework 1.0 (each class had to be contained in a single .cs file). Under
the Framework 2.0 (and later), this was added for the purpose of "cleaning"
the autogenerated classes, so that you could have the autogenerated part
(such as the design for a winform) in a file that you never edit, and then
add your own members on a separate file. It can also be useful in the case
were several developers are working on the same class. You can split the
class into several files, and have each of your developers check out of the
source code control system one of the fragments of the class.

Jun 27 '08 #4
The partial keyword allows the class, struct, or interface to span across multiple files. Typically a class will reside entirely in a single file. However, in situations where multiple developers need access to the same class, or more likely in the situation where a code generator of some type is generating part of a class, then having the class in multiple files can be beneficial.
1.Partial classes can improve code readability and
maintainability by providing a powerful way to extend the
behavior of a class and attach functionality to it.

2.The partial modifier can only appear immediately before
the keywords class, struct, or interface.

3.Nested partial types are allowed in partial-type
definitions.

4.Using partial classes helps to split your class
definition into multiple physical files.

5.Note that the partial keyword applies to classes,
structs, and interfaces, but not enums
Jun 27 '08 #5
Hi Jon and others,

In my idea is Marc right, I am not such a regular in this newsgroup, however
Marc follows exactly the policy from some other dotnet newsgroups.

It make no sense to help a student with his answers. Have a look as Marc
wrote to his others questions where he becomes even lazy in that.

Cor
"Jon Skeet [C# MVP]" <sk***@pobox.comschreef in bericht
news:ca**********************************@x35g2000 hsb.googlegroups.com...
On May 19, 6:27 am, satyanarayan sahoo wrote:
What’s the role of Partial keyword which is bydefault written for a class
in 2.0 ?

public partial class Form1 : Form
It's only included by default for classes which have an associated
designer. As Marc says, your questions do sound somewhat like homework
assignments...

(A search for "partial keyword C#" finds plenty of results...)

Jon

Jun 27 '08 #6
Cor Ligthert[MVP] <no************@planet.nlwrote:
In my idea is Marc right, I am not such a regular in this newsgroup, however
Marc follows exactly the policy from some other dotnet newsgroups.

It make no sense to help a student with his answers. Have a look as Marc
wrote to his others questions where he becomes even lazy in that.
Well, I was:

a) correcting the statement within the question
b) giving the poster information to answer his own question

I agree that doing people's homework for them is a bad idea, but I
really don't think I was doing that.

--
Jon Skeet - <sk***@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Jun 27 '08 #7

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

Similar topics

220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
54
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO...
56
by: Xah Lee | last post by:
What are OOP's Jargons and Complexities Xah Lee, 20050128 The Rise of Classes, Methods, Objects In computer languages, often a function definition looks like this: subroutine f (x1, x2, ...)...
12
by: Steven T. Hatton | last post by:
This is something I've been looking at because it is central to a currently broken part of the KDevelop new application wizard. I'm not complaining about it being broken, It's a CVS images. ...
72
by: E. Robert Tisdale | last post by:
What makes a good C/C++ programmer? Would you be surprised if I told you that it has almost nothing to do with your knowledge of C or C++? There isn't much difference in productivity, for...
3
by: Steven T. Hatton | last post by:
I stumbled upon this blog while googling for something. I have to say, I really don't understand what Lippman is trying to tell me here. I included the first paragraph for context, but the second...
18
by: cj | last post by:
members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe. I'm under the impression before you can use a class you have to make an...
4
by: N.RATNAKAR | last post by:
hai, what is abstract class and abstract method
44
by: Steven D'Aprano | last post by:
I have a class which is not intended to be instantiated. Instead of using the class to creating an instance and then operate on it, I use the class directly, with classmethods. Essentially, the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
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...

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.