In this program, You will learn how to implement static variables and methods in C#.
static int x = 10;
static void msg(){
//statement
}
using System;
public class Test
{
static int x = 10;
static void msg()
{
Console.WriteLine("static method is called here");
Console.WriteLine("x value is:" + x);
}
public static void Main(string[] args)
{
msg();
}
}
static method is called here
x value is:10