Hi Guest

MobileUser

1 HomePage 1 Jobs 1 WalkIn 1Articles  

Cat Exam

 :) Latest Topic
AJAX
VB.NET
SQL Query
UDDI
CLASS
JavaScript Questions
SharePoint Interview
SilverLight
WCF
general knowledge
 ASP.NET
 :) Hot Jobs
 
 :) Latest Articles


  

 


Simplest definition of partial classes and its rules?
Question Posted on 23 Dec 2020

Home >> DotNet >> C# >> Simplest definition of partial classes and its rules?




Simplest definition of partial classes and its rules?
Partial class is usually used to split definition of class in 2 or more classes which should be either in one source code file or in more than one source file. Here we can create class definition in multiple files but these are compiled as only one class at run time. And when we create a instance of this partial class then we can access all methods from source files with same object. So we used "Partial" keyword with all the class names that we want to bind together with the same name of a class in the same namespace. Below image will clarify you the definition of partial class:-


Partial Class
Rules:-
(1)All definition of partial class must be in same seembly and namespace.
(2)All parts have the same accessibility like public or private, etc.
(3)If we declared and part as abstract, sealed or base type then the whole class is declared of the same type.
(4)partial Nested types are allowed.
(5)Different parts can have different base types and so the final class will inherit all the base types.
(6)Partial modifier can only appear immediately before the keywords class, struct, or interface.
(7)Partial methods can be generic or static methods.
(8)Partial methods can have in or ref but not out parameters.
(9)Partial methods are implicitly private methods, so cannot be virtual.
(10)Partial methods must use the partial keyword and must return void.
(11)Partial methods can have in or ref but not out parameters.
0
0



 
 Input Your Comments Or suggestions(If Any)
 Name
 Email(optional)
 Comments


Other Important Questions
Simplest definition of partial classes and its rules?
Definition of Tuple class with some examples?
Define Race Condition in cSharp?
C#.Net Reserve Words
can we inherit private class level variables in c#






 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |