Click here to Skip to main content
16,004,977 members
Home / Discussions / C#
   

C#

 
Questiongreetings Pin
PatrickDGreat18-Jul-06 16:12
PatrickDGreat18-Jul-06 16:12 
AnswerRe: greetings Pin
Colin Angus Mackay18-Jul-06 20:19
Colin Angus Mackay18-Jul-06 20:19 
Question2.0 How to pass role data via CreateUser Wizard Pin
AlexKiat18-Jul-06 15:29
AlexKiat18-Jul-06 15:29 
QuestionDisplay data from a child table in a textbox Pin
Glen Harvy18-Jul-06 14:30
Glen Harvy18-Jul-06 14:30 
AnswerRe: Display data from a child table in a textbox Pin
led mike18-Jul-06 17:39
led mike18-Jul-06 17:39 
GeneralRe: Display data from a child table in a textbox Pin
Glen Harvy18-Jul-06 20:23
Glen Harvy18-Jul-06 20:23 
GeneralRe: Display data from a child table in a textbox Pin
led mike18-Jul-06 20:56
led mike18-Jul-06 20:56 
QuestionDispose method - release resource Pin
MatejGo18-Jul-06 13:42
MatejGo18-Jul-06 13:42 
Hello,

I want to destroy an object without GC help. I read a lot of stuff how to do it, but im confused.
I realise that I must implement a Dispose metod, but I dont know how to release resources inside Dispose(bool) method. I will try to explain that into this example:

public class MyClass
{
long dolgo;
public MyClass(long lo)
{
dolgo = lo;
}

public ~MyClass()
{
Dispose(false);
}

public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this); // Finalization is now unnecessary
}

protected virtual void Dispose(bool disposing)
{
if(!m_disposed)
{
if(disposing)
{
// Dispose managed resources
//(how to dispose it, if in this class isnt any object)
}
// Dispose unmanaged resources
}
m_disposed = true;
}

private bool m_disposed = false;
}

class Program {
static void Main (string[]args){
MyClass mc=new MyClass(thisIsAnLongValue);

//here I do stuff...........

/* and here i want to deleate this object. I realise that I must call mc.Dispose();(or something like that), but I dont know how to release resources into the Dispose(bool) method ( in every example is an object to dispose inside the object class, but I dont have it I have only a variable long).*/
}
}

will be eny diference, if there is an array like MyClass[] mc;(mc destroy==?)

Thanks




Matej
AnswerRe: Dispose method - release resource Pin
Robert Rohde18-Jul-06 18:45
Robert Rohde18-Jul-06 18:45 
GeneralRe: Dispose method - release resource Pin
MatejGo19-Jul-06 20:39
MatejGo19-Jul-06 20:39 
GeneralRe: Dispose method - release resource Pin
Robert Rohde20-Jul-06 10:49
Robert Rohde20-Jul-06 10:49 
AnswerRe: Dispose method - release resource Pin
Andrei Ungureanu18-Jul-06 19:48
Andrei Ungureanu18-Jul-06 19:48 
QuestionHosting .NET Windows Forms Controls in IE Pin
JuanAlbertoMD18-Jul-06 12:29
JuanAlbertoMD18-Jul-06 12:29 
AnswerRe: Hosting .NET Windows Forms Controls in IE Pin
User 171649218-Jul-06 12:47
professionalUser 171649218-Jul-06 12:47 
QuestionWCL problem Pin
-Yoyosh-18-Jul-06 12:22
-Yoyosh-18-Jul-06 12:22 
QuestionAll pipe instances are busy" when working with IpcChannel Pin
Ilia Blank18-Jul-06 9:53
Ilia Blank18-Jul-06 9:53 
Questionanimation on win form like that of MSN messenger? Pin
sinanju18-Jul-06 9:47
sinanju18-Jul-06 9:47 
AnswerRe: animation on win form like that of MSN messenger? Pin
Josh Smith18-Jul-06 9:52
Josh Smith18-Jul-06 9:52 
GeneralRe: animation on win form like that of MSN messenger? Pin
sinanju18-Jul-06 10:03
sinanju18-Jul-06 10:03 
AnswerRe: animation on win form like that of MSN messenger? Pin
leppie18-Jul-06 9:58
leppie18-Jul-06 9:58 
GeneralRe: animation on win form like that of MSN messenger? Pin
sinanju18-Jul-06 10:06
sinanju18-Jul-06 10:06 
AnswerRe: animation on win form like that of MSN messenger? Pin
sinanju18-Jul-06 10:18
sinanju18-Jul-06 10:18 
QuestionDateTime Pin
NewbProgrammer18-Jul-06 9:36
NewbProgrammer18-Jul-06 9:36 
AnswerRe: DateTime Pin
User 665818-Jul-06 9:39
User 665818-Jul-06 9:39 
AnswerRe: DateTime Pin
Josh Smith18-Jul-06 9:39
Josh Smith18-Jul-06 9:39 

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.