GeekInterview.com
Series: Subject: Topic:
Question: 21 of 95

what is the concept of partial class in .net2.0?

Asked by: Interview Candidate | Asked on: Jun 2nd, 2007
Showing Answers 1 - 2 of 2 Answers
Rajesh Bathala

Answered On : Jun 13th, 2007


Partial class allows developers to split a class into multiple files.


ex:

public partial class A
{
    A()
   
    {
        //constructor here

    }

}

Suppose another developer needs to add a new function to it called updated A , the other developer can creat a new file call it A1.cs and it should be look something like this.

public partial cllass A

{
  public void update A()
  {
     // function code goes here
    }
}


while using partial classes ,if we have declared a constructor or a function in one source file, we can not define the same in the other partial source file.

  The .NET runtime executes  these two classes it treats  two or multiple source file as one single class A.


Regards

Rajesh Bathala

Yes  2 Users have rated as useful.
  
Login to rate this answer.
Pradeep Srini

Answered On : May 24th, 2011

View all answers by Pradeep Srini

Partial class is to split the class into multiple files

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.