Click here to Skip to main content
15,884,298 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Do I need to release .NET 3.5 SP1 to all users? Pin
led mike19-Mar-09 4:33
led mike19-Mar-09 4:33 
GeneralRe: Do I need to release .NET 3.5 SP1 to all users? Pin
Pete O'Hanlon19-Mar-09 12:57
mvePete O'Hanlon19-Mar-09 12:57 
GeneralRe: Do I need to release .NET 3.5 SP1 to all users? Pin
led mike20-Mar-09 4:37
led mike20-Mar-09 4:37 
GeneralRe: Do I need to release .NET 3.5 SP1 to all users? Pin
Dave Kreskowiak19-Mar-09 14:04
mveDave Kreskowiak19-Mar-09 14:04 
AnswerRe: Do I need to release .NET 3.5 SP1 to all users? Pin
Simon P Stevens18-Mar-09 6:51
Simon P Stevens18-Mar-09 6:51 
QuestionSiteLock template on C# Pin
budarin17-Mar-09 11:57
budarin17-Mar-09 11:57 
QuestionIDisposable, Inheritance and Event Handlers Pin
Alex Feature17-Mar-09 9:36
Alex Feature17-Mar-09 9:36 
AnswerRe: IDisposable, Inheritance and Event Handlers Pin
Natza Mitzi17-Mar-09 10:02
Natza Mitzi17-Mar-09 10:02 
Hi, you need to override and not overload. all dispose methods should be called from the leaf type to the top. I think that you should clean up after your self when creating objects that are disposable. in large objects you should also set values to null explicitly to free the memory faster. The next code calls all methods when disposing:



///
/// The main entry point for the application.
///

[STAThread]
static void Main()
{

//This code should go in the main
//ObjectB1 inherits from ObjectB which innhertis from ObjectA
ObjectB1 b1 = new ObjectB1();

//Calling the dispose will call the dispose of ObjectB1
//within the dispose of ObjectB1 there is a call to the base dispose.

b1.Dispose();
}


public partial class ObjectA : UserControl
{
public ObjectA()
{
InitializeComponent();
}

private void ObjectA_Load(object sender, EventArgs e)
{

}
}

public class ObjectB : ObjectA
{
public event EventHandler ObjectBEvent;

public ObjectB()
{
this.MouseClick += new MouseEventHandler(ObjectB_MouseClick);
}

void ObjectB_MouseClick(object sender, MouseEventArgs e)
{

}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);

MessageBox.Show("Dispose : ObjectB");
ObjectBEvent = null;
}

protected virtual void OnObjectBEvent(EventArgs e)
{
if (ObjectBEvent != null)
{
ObjectBEvent(this, e);
}
}
}

public class ObjectB1 : ObjectB
{
public event EventHandler ObjectB1Event;

public ObjectB1()
{
this.MouseClick += new MouseEventHandler(ObjectB1_MouseClick);
}

void ObjectB1_MouseClick(object sender, MouseEventArgs e)
{

}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);

MessageBox.Show("Dispose : ObjectB1");
ObjectB1Event = null;
}

protected virtual void OnObjectB1Event(EventArgs e)
{
if (ObjectB1Event != null)
{
ObjectB1Event(this, e);
}
}
}

Natza Mitzi

GeneralRe: IDisposable, Inheritance and Event Handlers Pin
Alex Feature17-Mar-09 21:07
Alex Feature17-Mar-09 21:07 
GeneralRe: IDisposable, Inheritance and Event Handlers Pin
Alex Feature18-Mar-09 2:07
Alex Feature18-Mar-09 2:07 
GeneralRe: IDisposable, Inheritance and Event Handlers Pin
Natza Mitzi18-Mar-09 3:30
Natza Mitzi18-Mar-09 3:30 
AnswerRe: IDisposable, Inheritance and Event Handlers Pin
S. Senthil Kumar19-Mar-09 3:53
S. Senthil Kumar19-Mar-09 3:53 
QuestionProblem in creating website with CMS Pin
itsravie17-Mar-09 5:37
itsravie17-Mar-09 5:37 
AnswerPick a forum and stick with it. Pin
Pete O'Hanlon17-Mar-09 6:07
mvePete O'Hanlon17-Mar-09 6:07 
GeneralRe: Pick a forum and stick with it. Pin
led mike17-Mar-09 8:06
led mike17-Mar-09 8:06 
AnswerRe: Problem in creating website with CMS Pin
led mike17-Mar-09 8:08
led mike17-Mar-09 8:08 
QuestionISSue with VS 2005 Pin
p_196016-Mar-09 22:38
p_196016-Mar-09 22:38 
Questioninvisible watermark in MS word files Pin
Ayesha Manzoor16-Mar-09 6:40
Ayesha Manzoor16-Mar-09 6:40 
AnswerRe: invisible watermark in MS word files Pin
0x3c016-Mar-09 6:52
0x3c016-Mar-09 6:52 
GeneralRe: invisible watermark in MS word files Pin
Ayesha Manzoor24-Mar-09 1:30
Ayesha Manzoor24-Mar-09 1:30 
AnswerRe: invisible watermark in MS word files Pin
led mike17-Mar-09 4:22
led mike17-Mar-09 4:22 
GeneralRe: invisible watermark in MS word files Pin
Ayesha Manzoor24-Mar-09 2:01
Ayesha Manzoor24-Mar-09 2:01 
GeneralRe: invisible watermark in MS word files Pin
led mike24-Mar-09 6:59
led mike24-Mar-09 6:59 
AnswerRe: invisible watermark in MS word files [modified] Pin
P13RC324-Mar-09 14:52
P13RC324-Mar-09 14:52 
GeneralRe: invisible watermark in MS word files Pin
Ayesha Manzoor26-Mar-09 9:02
Ayesha Manzoor26-Mar-09 9:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.