473,320 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Dispose a Class?

JP
How do you dispose of an user defined external class (CS file) after youve
finished using it? Ive tried IDispose but i feel I may not be using it
correctly.

--
JP
..NET Software Develper
Jul 21 '05 #1
1 1324
I'm not sure I understand you correctly when you say "a user defined
external class", do you mean this an instance of an object which class is
defined in another assembly ?

If you own the object and you want to dispose it, you must ask for
IDisposable and call Dispose on it.

Note that if somebody is keeping a reference to this object besides you, you
will cause it to fail, for example, if a Font object is passed to you this
Font object may have also been passed to other controls, so disposing it
will not be advised here unless you know that all of the other controls are
also being disposed, calling Dispose multiple times is ok, using an object
after it is disposed (for example trying to draw a text with a disposed
Font) is not.

--
Francisco Padron
www.chartfx.com

"JP" <JP@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
How do you dispose of an user defined external class (CS file) after
youve
finished using it? Ive tried IDispose but i feel I may not be using it
correctly.

--
JP
.NET Software Develper

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: faktujaa | last post by:
Hi All, A small confusion. I have defined a connection class that has System.Data.IDbConnection as a member variable and implements IDisposable interface. I have implemented Dispose method to call...
4
by: RiteshDotNet | last post by:
..net Frame work 1. Dispose Method what it does ? A. who its call / when it calls ? B. Is it fire automatically ? c. When dispose method is call what it does ? D. Release a Object from memory or...
11
by: Ken Durden | last post by:
I am in search of a comprehensive methodology of using these two object cleanup approaches to get rid of a number of bugs, unpleasantries, and cleanup-ordering issues we currently have in our...
4
by: Sunit Joshi | last post by:
Hello All I have an abstract class C1 with this: public abstract class C1 { protected bool m_Dirty; protected override void Dispose(bool disposing) { if(m_Dirty) WriteOuput();
7
by: Tamir Khason | last post by:
I have a class public class Foo { public Foo() { DoSomething() } } I want to be able to do something else while the class enters GC - no more
0
by: Fernando Cacciola | last post by:
Hi People, Consider the following: class A : IDisposable { public A ( Stream aResource ) { mResource = aResource ; } public void Dispose() {
1
by: Billy | last post by:
Hello... I'm trying to make a database access class for an asp.net application. When I run my application, the Garbage Collecter doesn't seems to unload the memory attributed to my...
9
by: Charles Law | last post by:
I have a form on which user controls are placed at runtime. When a control is added to the form a handler is added for an event that a high-level object raises, which must be handled by the new...
156
by: Dennis | last post by:
Ok, I'm trying to dispose of every object that I create that has a dispose method based on advice from this newsgroup. However, I'm not sure how to dispose of the following object that was created...
13
by: Grafix | last post by:
All - As we all know, Dispose method is reserved in C++ 8 and the expected syntax is to use ~MyClass(). In 1.1, we used to have following structure for Dispose class MyClass : IDisposable {...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.