Partial Classes in C#

PartialClass1.cs
using System;

namespace CSharpBasics
{
    partial class PartialClass1
    {
        public PartialClass1(int j)
        {
            i = 12;
        }
        public void FromFileClass1()
        {
            Console.WriteLine("From File 1, Value of i : " + i.ToString());
        }
    }
}


PartialClass1_2.cs
using System;

namespace CSharpBasics
{
    partial class PartialClass1
    {
        int i = 0;

        public void FromFileClass2()
        {
            Console.WriteLine("From File 2, Value of i : " + i.ToString());
        }
    }
}
Add Comments :

Login

Register