We cannot create object of a static class

Sourav.Kayal
Posted by Sourav.Kayal under C# category on | Points: 40 | Views : 1171
using System;
using System.Linq;
using System.Text;
using System.Collections;
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;
namespace BlogProject
{
static class TestClass
{
public static void Print()
{
Console.WriteLine("Static Class");
}
}

class Program
{
static void Main(string[] args)
{
//Error-because it's not possible to create object of static class
TestClass t = new TestClass();
Console.ReadLine();
}
}
}

Comments or Responses

Login to post response