GeekInterview.com
Series: Subject: Topic:
Question: 30 of 58

What is Partial class

Asked by: hksjadon | Member Since Sep-2006 | Asked on: Sep 26th, 2006

View all questions by hksjadon

Editorial / Best Answer

Answered by: bb.geetha

View all answers by bb.geetha

Member Since May-2008 | Answered On : Jun 12th, 2008

A Partial class is a class that can be split into two or more classes. This means that a class can be physically separated into other parts of the class within the same namespace. All the parts must use the partial keyword. All the other classes should also have the same access modifier. At the compile time, all the partial classes will be treated as a single class. Let us list some advantages of having partial classes.

Showing Answers 1 - 8 of 8 Answers
Sohaib Ahmad

Answered On : Sep 28th, 2006

The class which can be split into mulitple files in partial class.

  
Login to rate this answer.
sriraja

Answered On : Nov 19th, 2006

 A class having splited into different files ex.. program.cs(application.run),form related files,class related files

  
Login to rate this answer.
don22222000

Answered On : Jul 13th, 2007

View all answers by don22222000

In ASP.Net, Partial Class is the common class that links the Presentation layer to the Code behind page. Its basically an inheritance class.

  
Login to rate this answer.
bornToLose

Answered On : Sep 22nd, 2007

It is possible to split class, struct and interface into multiple source file. Each file contain section of class definition and combined all file at time of compilation.  It is used when:

1. Program is very large

2. Automatic generate source code

  
Login to rate this answer.

Partial Class helps to split our classes into multiple physical files.Benifits:Isolate Business logic of an applicatoin from a user interface.Facilitates easier debugging.

  
Login to rate this answer.
bb.geetha

Answered On : Jun 12th, 2008

View all answers by bb.geetha

A Partial class is a class that can be split into two or more classes. This means that a class can be physically separated into other parts of the class within the same namespace. All the parts must use the partial keyword. All the other classes should also have the same access modifier. At the compile time, all the partial classes will be treated as a single class. Let us list some advantages of having partial classes.

Yes  2 Users have rated as useful.
  
Login to rate this answer.
hellodebasish

Answered On : May 22nd, 2009

View all answers by hellodebasish

The class having partial keyword and same name. One class can split into more than two parts having same name and partial keyword. In the time of object creation all partial class group together to make the single object.

The main aim for the partial class is that giving more liberty to the developer, different developer can work on same class without interpreting to eachother.

  
Login to rate this answer.
lata negi

Answered On : Nov 4th, 2011

View all answers by lata negi

Partial class is a new feature added to .NET Framework 2.0. .NET 1.0 or 1.1, does not support for partial classes.
It is possible to split the definition of a class or a struct, or an interface over two or more source files. Each source file contains a section of the class definition, and all parts are combined when the application is compiled.

When working on large projects, spreading a class over separate files allows multiple programmers to work on it simultaneously.

Points to be noted while writing code for partial classes:-

All the partial definitions must proceeded with the key word "Partial".

All the partial types meant to be the part of same type must be defined within a same assembly and module.
Method signatures (return type, name of the method, and parameters) must be unique for the aggregated typed (which was defined partially).

The partial types must have the same accessibility.
If any part is sealed, the entire class is sealed.
If any part is abstract, the entire class is abstract.
Inheritance at any partial type applies to the entire class.

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.