Partial Classes in C sharp #60



Partial Classes in C sharp #60

Suggested Videos

 ❑ What are partial classes. 

❑ What are the advantages or uses of partial  classes? 

❑ Where are partial classes used.



Partial Classes

❑ Partial classes allow us to spilt a class into 2 or more  files . All there parts are then combined into a single class, when the application is compiled .The partial keyword also be used to split a struct or interface over two or more files.

❑ Advantages of partial classes.
1.The main advantage is that, visual studio uses partial class to separate , Automatically generated  system  code from the developer’s code . For example , when you add a webform ,two .CS files are generated.

a) WebForm1.aspx.cs-Contains the developer code.
 b) WebForm1.aspx.designer.cs-Contains the system generated code .For example, declarations for the controls that you drag and drop on the webfrom.
 
2.When  working on large projects, spreading a class over separate files allows multiple programmers to work on it simultaneously .Though, Microsoft claims this as an advantage , I haven’t really seen anywhere , people using partial classes, just to work on them simultaneously.

Follow Us

YouTube

 If you want to download pptx : click Telegram

Facebook

Twitter

Instagram

Tik Tok


إرسال تعليق

أحدث أقدم