473,811 Members | 2,911 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1457
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
"satyanaray an 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.co mschreef in bericht
news:ca******** *************** ***********@x35 g2000hsb.google groups.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.co m>
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
19207
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 any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it seems that Ruby has the potential to compete with and displace Python. I'm curious on what basis it...
54
6588
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 FRICKIN' COOL!!! ***MAN*** that would save me a buttload of work and make my life sooooo much easier!" As opposed to minor differences of this feature here, that feature there. Variations on style are of no interest to me. I'm coming at this from a...
56
3771
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, ...) { variables ... do this or that }
12
3309
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. Such things happen. The whole subsystem is going through radical changes. I don't really want to say what I think of the code just yet. That would influence the opinions of others, and I really want to know how other people view these things,...
72
5905
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 example, between a C/C++ programmers with a few weeks of experience and a C/C++ programmer with years of experience. You don't really need to understand the subtle details or use the obscure features of either language
3
1642
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 paragraph is the one that has me most confused. <quote url="http://blogs.msdn.com/slippman/archive/2004/01/27/63473.aspx"> In C++, a programmer can suppress a virtual call in two ways: directly use an object of the class, in which case the...
18
1986
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 instance of it. So how can a class be threadsafe by itself but an instance of it not be? I guess I don't get what exactly being threadsafe means. Multiple theads can use the same instance of a class?
4
3207
by: N.RATNAKAR | last post by:
hai, what is abstract class and abstract method
44
2962
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 class is used as a function that keeps state from one call to the next. The problem is that I don't know what to call such a thing! "Abstract class" isn't right, because that implies that you should subclass the class and then instantiate the...
0
9730
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
9605
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
10651
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
10392
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
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...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4341
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
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.