TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Amol Sarkate
NA
634
156.7k
how to destroy current object from constructor..?
Mar 25 2017 3:21 AM
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++;
}
}
}
}
Reply
Answers (
5
)
Not able to read COM3 port. Always output is 0
how to Create gridview windows application in c# asp.net