Solved

Is it safe to kill the class instance and recreate another within an event in the instance itself? C# .Net

Posted on 2008-06-15
2
279 Views
Last Modified: 2008-06-29
Is it safe to kill the class instance and recreate another within an event in the instance itself?
for example:
I have a class class1
Then in the Main method i instantiate it
class1 MyClass = new class1;

then witin a event procedure inside class1 I want to do this below.
this = null;
MyClass2 = new class1;
// MyClass2 is a ref variable that was passed in .

is this kind of thing safe in C#?
what consequences can I expect?

0
Comment
Question by:indikad
2 Comments
 
LVL 13

Accepted Solution

by:
joechina earned 250 total points
ID: 21793712
I don't think you can assign any value to 'this'
It's readonly.
what do you want to accomplish?
0
 

Author Comment

by:indikad
ID: 21842871
I wont to get rind of the current instace and create a new instance.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now