Static data member in C#

Sourav.Kayal
Posted by Sourav.Kayal under C# category on | Points: 40 | Views : 748
using System;
using System.Linq;
using System.Text;
using System.Collections;
using System.Data;
using System.Xml;
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Threading;
namespace BlogProject
{
class StaticTest
{
public static Int32 Value=0;
}
class Program
{
//Static variable is not belongs to particular object
//It is common to all ,so that it's allow to call static variable
//using Class name
static void Main(string[] args)
{
StaticTest.Value = 100;
Console.WriteLine(StaticTest.Value);
Console.ReadLine();
}
}
}

Comments or Responses

Login to post response