top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is partial class? and why Microsoft has introduced it?

+4 votes
232 views
What is partial class? and why Microsoft has introduced it?
posted Nov 28, 2014 by Manikandan J

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

We all know that Partial class allows us to split the definition of a class over two or more source files. Each source file contains a section of the type or method definition, and all parts are combined when the application is compiled. When it comes "Why Microsoft has introduced it?" we usually say "When working on large projects, spreading a class over separate files enables multiple programmers to work on it at the same time".
But when I had been asked this question, interviewer was expecting some different explanation i.e. Microsoft has introduced Partial Classes because it was their own requirement to produce the automatically generated source code.
Visual Studio uses this approach when it creates Windows Forms, Web service wrapper code, and so on. We can create code that uses these classes without having to modify the file created by Visual Studio.
So we can put some extra impression by adding above line in to our answer.

answer Dec 1, 2014 by Shivaranjini
Similar Questions
+1 vote

Explain about Partial Class

+5 votes

If there are two interfaces having one method with same signature. and your class is implementing both. and you have implemented that method only once. So in this case will it work or any warning or error will come? if works then how compiler will come to know method of which interface you are implementing?

+5 votes

How does it work actually and why it is introduced in lte network ?

...