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 NonActionAttribute ?
Why to use Html.Partial in ASP.Net MVC?
What is the purpose of a web form?
Explain what is routing?
Why to use '{resource}.axd/{*pathInfo}' in routing in ASP.Net MVC?
What are the major improvements provided by the common language runtime and the base class libraries? Or what are the major improvements in .net framework 4.0?
What is the difference between tempdata and viewbag?
What is representational state transfer (rest) mean?
Difference between ASP.NET MVC and ASP.NET WebForms?
What filters are executed in the end?
How do you assign a value to a complex number 7 how has exception hand changed in .net framework 4.0?
What is mvc entity framework?
What is RouteConfig.cs in ASP.Net MVC 4?
What symbol would you use to denote, the start of a code block in razor views?
List out few different return types of a controller action method?