Create Partial Classes in C#

This blog defines how to create partial Classes in C#.
 
class Program
{
    static void Main(string[] args)
    {
            Class_PartialEg obj = new Class_PartialEg();
            Console.WriteLine("Partial Class1:-obj.add_numbers(5, 4)=" + obj.add_numbers(5, 4));
            Console.WriteLine("Partial Class1:-obj.sub_numbers(10, 5)=" + obj.sub_numbers(10, 5));
           Console.WriteLine("Partial Class2:-obj.Div(10, 5)=" + obj.Div(10, 5));
           Console.WriteLine("Partial Class2:- obj.Mult(10, 5)=" + obj.Mult(10, 5));
           Console.ReadLine();
      }
}
 
---------------------------------------------------
 public partial class Class_PartialEg
{
      public int add_numbers(int a, int b)
       {
            return a + b;
        }
      public int sub_numbers(int a, int b)
      {
            return a - b;
        }
 
public partial class Class_PartialEg
{
      public int Div(int a, int b)
      {
          return a/b;
      }
     public int Mult(int a, int b)
    {
         return a * b;
    }
}
Ebook Download
View all
Learn
View all