if we create a class and fro that class we created six instance we want only five see example in comment section w ahve to destroy current object how like
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Employee obj = new Employee();
Employee obj1 = new Employee();
Employee obj2 = new Employee();
Employee obj3 = new Employee();
Employee obj4 = new Employee();
Employee obj5 = new Employee();
Employee obj6 = new Employee();
Console.Read();
}
}
class Employee
{
static int count = 0;
public Employee()
{
if (count == 5)
{
// here we need to distroy na current object
}
else
{
count++;
}
}
}
}
5 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

Tapan PatelPosted Mar 27, 2017, 11:13 AM
Amit GuptaPosted Mar 25, 2017, 5:29 AM
Ramesh PalanivelPosted Mar 25, 2017, 4:05 AM
Amol SarkatePosted Mar 25, 2017, 3:53 AM
Ramesh PalanivelPosted Mar 25, 2017, 3:33 AM