---
title: "Partial Classes in C#"  
description: "In this blog, I’m explaining about the partial classes in C#.  A partial class allow a single class to be divided into two separate physical file.Duri"  
author: "priyanka kushwaha"  
published: 2015-01-24  
updated: 2015-01-24  
canonical: https://www.mindstick.com/blog/731/partial-classes-in-c-sharp  
category: ".net"  
tags: [".net"]  
reading_time: 1 minute  

---

# Partial Classes in C#

In this [blog](https://www.mindstick.com/articles/12705/myths-and-misconception-about-blog), I’m explaining about the partial [classes in C#](https://www.mindstick.com/forum/160391/explain-the-difference-between-generic-classes-and-non-generic-classes-in-c-sharp).\

A [partial class](https://www.mindstick.com/forum/155717/define-partial-class-in-mvc) allow a single class to be divided into [two separate](https://www.mindstick.com/forum/159375/how-to-communicate-with-two-separate-database-in-mssql-server) [physical](https://answers.mindstick.com/qa/116088/what-are-the-main-functions-of-the-physical-layer) file.

During [compile](https://www.mindstick.com/forum/2316/how-to-views-compile-in-mvc) time, these [files](https://www.mindstick.com/articles/23302/the-importance-and-advantage-of-keeping-your-important-files-on-the-cloud) get compiled into a single class.

##### Example

```
namespace PartialClassProgram{  partial class PartialClass{  public void add(int a, int b) {     System.Console.WriteLine("Result=" + a + b); }}partial class PartialClass{   public void add(string a, string b)  {     System.Console.WriteLine("Result=" + a + b);  }}class Program{static void Main(string[] args)  {  string s = "String1";string s1 = " String2";PartialClass objpartial = new PartialClass();  objpartial.add(s, s1);objpartial.add(1, 2);Console.ReadLine();  } } }
```

---

Original Source: https://www.mindstick.com/blog/731/partial-classes-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
