---
title: "Partial Class"  
description: "When we want to split class we use partial keyword. The main advantage of partial class is that more than one programmer can work on same class at a t"  
author: "Anonymous User"  
published: 2010-07-15  
updated: 2019-09-07  
canonical: https://www.mindstick.com/articles/31/partial-class  
category: ".net"  
tags: [".net"]  
reading_time: 1 minute  

---

# Partial Class

When we want to split class we use partial keyword. The main advantage of partial

class is that more than one programmer can work on same class at a time i.e. they

can implement same class.

##### Example

![Partial Class](https://www.mindstick.com/mindstickarticle/03c13378-639d-432b-84e9-6a84ed72c41b/images/6adf643a-fcde-4469-8343-82884fa58376.png)

```
private void btnAdd_Click(object sender, EventArgs e)        {//creating instance of class            c c1 = new c();//calling add() method of class            MessageBox.Show(c1.add(2,4).ToString());        }         private void btnSub_Click(object sender, EventArgs e)        {            c c1 = new c();//calling sub() method of class            MessageBox.Show(c1.sub(4,3).ToString());        }   //half of the class is defined here    public partial class c    {        public int add(int a, int b)        {            return a+b;        }    }        //another half of class cpublic int sub(int a, int b)        {            return a - b;        } 
```

## Screen shots

![Partial Class](https://www.mindstick.com/mindstickarticle/03c13378-639d-432b-84e9-6a84ed72c41b/images/b532d66b-0b20-46f5-b145-b56f666a8ed8.png)![Partial Class](https://www.mindstick.com/mindstickarticle/03c13378-639d-432b-84e9-6a84ed72c41b/images/0c4573d2-6eae-4692-80c4-21fda6e87604.png)**\**

---

Original Source: https://www.mindstick.com/articles/31/partial-class

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
