Can we have more than 1 partial classes in the same file?

Answer Posted / mahesh kotekar

It is possible to have partial class in same class file.

Partial Class Concept was used in dotnet to provide
practically dividing the class into two or multiple physical
files. In order to keep the complexity of class
simple.During compilation the partial classes join together
to form a single class and works as normal class
partial class First
{
public static void DoSomething1()
{
Console.WriteLine("Executing from First Part of
Class First");
}
}
partial class First
{
public static void DoSomething2()
{
Console.WriteLine("executing from second part of
class First");
}
}

Is This Answer Correct ?    9 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is .net core framework?

540


How we can add the css in mvc?

599


How OS come to know whether to load the .net framework when we run an .exe created using .Net framework?

572


What symbol would you use to denote, the start of a code block in razor views?

573


Which are the important namespaces used in ASP.Net MVC?

601






Why is entity framework used?

577


what is conceptual model?

608


mention what is csdl, ssdl and msl sections in an edmx file?

579


Explain the advantages and disadvantages of ASP.Net MVC over ASP.NET?

542


What is stateless model?

520


How do I install .net framework?

534


What are the benefits of .net framework?

570


What are html helpers in asp.net mvc?

563


What is entity framework? : Entity framework

568


Explain the role of assembly in the .net framework.

574