Javatpoint Logo
Javatpoint Logo

C# Partial Types

C# provides a concept to write source code in separate files and compile it as a single unit. This feature is called partial types and included in C# 2.0. The partial keyword is used to create partial types.

It allows us to write partial class, interface, struct and method in two or more separate source files. All parts are combined when the application is compiled.

Let's see an example. Here, we are creating a partial class that includes a depositeAmount() function in the Customer.cs file and a withdraw() function in the Customer2.cs file. Both functions are stored in separate file and combined when compiled.

C# Partial Class Example

// Customer.cs

// Customer2.cs


Current balance is: 2000
amount is deposited
Available balance is: 3000
500 is withdrawn
Available balance is: 2500

Next TopicC# Iterators

Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials

B.Tech / MCA