Sunday, 3 December 2017

C# Program to Implement Static Method


Code:

using System;
class Program
{
    static void stamethod()
    {
        Console.WriteLine("Static Method");
    }
    void MethodB()
    {
        Console.WriteLine("Instance Method");
    }
    static char stamethod2()
    {
        Console.WriteLine("Static Method");
        return 'C';
    }
    static void Main()
    {
        Program.stamethod();
        Console.WriteLine(Program.stamethod2());
        Program programInstance = new Program();
        programInstance.MethodB();
        Console.Read();
    }
}


Output:

Static Method
Static Method
C
Instance Method


More C# Programs:




















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...