what are partial classes?

Answers were Sorted based on User's Feedback



what are partial classes?..

Answer / chaitanya.k

Partial classes is a new feature of OOPs in .NET2.0

Partial classes means split the class into multiple files.


For example

u r working with windows applications actually
designer.cs is using a class like webform1, u can use this
class in other cs file also.

Is This Answer Correct ?    59 Yes 13 No

what are partial classes?..

Answer / anna

using a partial class, we can split a class into multiple
files.
compiler will treat them as different classes.
but when compiled all the files will be treated as a single
class.
it is more efficeint

Is This Answer Correct ?    45 Yes 7 No

what are partial classes?..

Answer / sridhar.venkataramanan

File 1.
partial class Employee
{
string employeename;
public void getEmployeeName(string empname)
{
employeename = empname;
}

public static void Main()
{

Employee objEmployee = new Employee();
objEmployee.getEmployeeName("Krish");
objEmployee.showEmployeeName();
Console.ReadLine();
}

}
File 2

partial class Employee
{
public void showEmployeeName()
{
Console.WriteLine("Name --->" + employeename);
}

}

Even though the method showEmployeeName is not a available
in file 1 since its partial class the complier would
combine the fragments of the file that corresponds to same
class.

Is This Answer Correct ?    28 Yes 6 No

what are partial classes?..

Answer / kamlesh sharma

through partial keyword we can split the defination of the
class in different source files and these definations are
combined when application is compiled.

it may be helpful in large projects,so many people can work
on same class

Is This Answer Correct ?    20 Yes 5 No

what are partial classes?..

Answer / rashmi tiwari

One of the greatest benefits of partial classes is that it
allows a clean separation of business logic and the user
interface (in particular the code that is generated by the
visual designer). Using partial classes, the UI code can be
hidden from the developer, who usually has no need to
access it anyway. Partial classes will also make debugging
easier, as the code is partitioned into separate files.

Is This Answer Correct ?    22 Yes 8 No

what are partial classes?..

Answer / sharif

Can you u explain me the code for the partaial class?

Is This Answer Correct ?    10 Yes 7 No

what are partial classes?..

Answer / anil

Partial class is th one feature in V2.0 where you can split
the functionalty of the single file in multiple files.

This is helpful on working simultaneously on same file,
clearly separates Business Logic and UI, separets logic
from single file to multiple files.

File1
Imports system
Interface IPartialInterface

sub abc( byval str as string)
sub abc()
End interface

Partial Class DemoPartialClass
dim strName a string
strName = "Anil"
Response.Write(strName)
End Class

File2

Imports system
Implements IPartialInterface

Partial Class DemoPartialClass
Public sub abc(ByVal strName as string)
Dim strValue as string
strValue = strName
End Sub
End Class

File 3

Imports system
Implements IPartialInterface

Partial Class DemoPartialClass
public sub abc()
response.write(strName)
End Sub
End Class

Is This Answer Correct ?    3 Yes 0 No

what are partial classes?..

Answer / sunny setia

The purpose of partial classes is to allow a class's
definition to span across multiple files. It is especially
useful for:

Allowing multiple developers to work on a single class at
the same time without the need for later merging files in
source control.

Allowing a separation between the class interface and the
implementation-related definitions

Easing the writing of code generators, such as visual designers.

Is This Answer Correct ?    5 Yes 4 No

what are partial classes?..

Answer / zahid nawaz

Partal classes can help in segregating code with respect
type like tool visual Studio generated,default imported
namespaces , events registration , variable declaration
code etc. It is best to split lengthy code into smaller
units but dealing them with same class Object

Is This Answer Correct ?    9 Yes 9 No

what are partial classes?..

Answer / rita ghosal

partial class is a incomplete class

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Dot Net Framework Interview Questions

How can you return string result from Action in ASP.Net MVC?

0 Answers  


What is conceptual model? : Entity framework

0 Answers  


what happened when type url in address bar and press enter?

5 Answers   IBM, Wipro,


How route table has been created in ASP.NET ASP.Net MVC?

0 Answers  


What are Satellite Assemblies? How you will create this?

4 Answers  






More on CLR ?

2 Answers   MMTS,


Does windows 10 need .net framework?

0 Answers  


How could we achieve Langauge Interoperability through "CLS"?? Please Expalin in detail with Example.. Thanks for the Help!!!!!

2 Answers   HCL,


what is conceptual model?

0 Answers   Microsoft,


If we not suppress finalize method in dispose what will happen?

2 Answers   Kanbay,


Where is tempdata stored?

0 Answers  


What are the methods in Thread class?

3 Answers  


Categories