what are partial classes?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a model in programming?

549


What is objectset? : Entity framework

546


What are the components required to create a route in ASP.Net MVC?

581


what is csdl?

582


What is difference between viewbag and viewdata and tempdata?

526






How to bind table colum with gridview column?

609


Which is the default http method for an action method?

505


What is entity framework in asp net?

533


Can we free memory explicitly without waiting for garbage collector to free the memory in .net compact framework?

533


How the ‘page lifecycle’ of ASP.Net MVC does works?

588


How do you assign a value to a complex number 7 how has exception hand changed in .net framework 4.0?

500


What are the advantages of razor view engine?

523


Where are the routing rules defined in an asp.net mvc application?

542


Can I use razor code in javascript in asp.net mvc?

535


What is the use of web api ? Why web api needed, if you have already restful services using wcf ?

546