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
What is a model in programming?
What is objectset? : Entity framework
What are the components required to create a route in ASP.Net MVC?
what is csdl?
What is difference between viewbag and viewdata and tempdata?
How to bind table colum with gridview column?
Which is the default http method for an action method?
What is entity framework in asp net?
Can we free memory explicitly without waiting for garbage collector to free the memory in .net compact framework?
How the ‘page lifecycle’ of ASP.Net MVC does works?
How do you assign a value to a complex number 7 how has exception hand changed in .net framework 4.0?
What are the advantages of razor view engine?
Where are the routing rules defined in an asp.net mvc application?
Can I use razor code in javascript in asp.net mvc?
What is the use of web api ? Why web api needed, if you have already restful services using wcf ?