Click here to Skip to main content
15,921,989 members
Home / Discussions / C#
   

C#

 
GeneralRe: store image into memory Pin
User 665826-Nov-08 5:26
User 665826-Nov-08 5:26 
GeneralRe: store image into memory Pin
George_George26-Nov-08 18:29
George_George26-Nov-08 18:29 
GeneralRe: store image into memory Pin
Guffa26-Nov-08 4:23
Guffa26-Nov-08 4:23 
GeneralRe: store image into memory Pin
George_George26-Nov-08 4:50
George_George26-Nov-08 4:50 
GeneralRe: store image into memory Pin
Guffa26-Nov-08 20:14
Guffa26-Nov-08 20:14 
GeneralRe: store image into memory Pin
George_George26-Nov-08 21:07
George_George26-Nov-08 21:07 
GeneralRe: store image into memory Pin
Guffa26-Nov-08 21:21
Guffa26-Nov-08 21:21 
GeneralRe: store image into memory Pin
George_George26-Nov-08 21:37
George_George26-Nov-08 21:37 
GeneralRe: store image into memory Pin
Guffa26-Nov-08 23:32
Guffa26-Nov-08 23:32 
GeneralRe: store image into memory Pin
George_George27-Nov-08 0:05
George_George27-Nov-08 0:05 
GeneralRe: store image into memory Pin
Guffa27-Nov-08 0:48
Guffa27-Nov-08 0:48 
GeneralRe: store image into memory Pin
George_George28-Nov-08 22:19
George_George28-Nov-08 22:19 
QuestionExposing List<> outside class [modified] Pin
Jan Sommer26-Nov-08 2:10
Jan Sommer26-Nov-08 2:10 
AnswerRe: Exposing List<> outside class Pin
leppie26-Nov-08 2:20
leppie26-Nov-08 2:20 
GeneralRe: Exposing List<> outside class Pin
Jan Sommer26-Nov-08 2:29
Jan Sommer26-Nov-08 2:29 
AnswerRe: Exposing List<> outside class Pin
leppie26-Nov-08 2:45
leppie26-Nov-08 2:45 
GeneralRe: Exposing List<> outside class Pin
Jan Sommer26-Nov-08 3:00
Jan Sommer26-Nov-08 3:00 
GeneralRe: Exposing List<> outside class Pin
leppie26-Nov-08 3:20
leppie26-Nov-08 3:20 
GeneralRe: Exposing List<> outside class Pin
Jan Sommer26-Nov-08 3:45
Jan Sommer26-Nov-08 3:45 
AnswerRe: Exposing List<> outside class Pin
Thomas Weller26-Nov-08 3:24
Thomas Weller26-Nov-08 3:24 
GeneralRe: Exposing List<> outside class Pin
Alan Balkany26-Nov-08 3:56
Alan Balkany26-Nov-08 3:56 
GeneralRe: Exposing List<> outside class Pin
Jan Sommer26-Nov-08 4:09
Jan Sommer26-Nov-08 4:09 
GeneralRe: Exposing List<> outside class Pin
Thomas Weller26-Nov-08 4:30
Thomas Weller26-Nov-08 4:30 
Questionimplement IDisposable issue Pin
George_George26-Nov-08 1:57
George_George26-Nov-08 1:57 
Hello everyone,

I have a static class which wraps a file stream object. And I want to implement the Dispose pattern. I define an uninitialize method in the static class which call Dispose explicitly with parameter value true. Here is my code,

My questions are,

1. Normally there should be a destructor in a class which calls Dispose with parameter value false, but for a static class, there is no concept like destructor, how to implement calling Dispose with false parameter?

2. When the Dispose method without parameter will be called?

3. Is it correct to call GC.SuppressFinalize(this)? Since for a static class, there is no "this" object?

4. Correct to define disposed as static field?

5. Are there anything wrong with my code?

static private StreamWriter currentLogStream;

private static bool disposed = false;

public void Dispose()
{
    Dispose(true);
    GC.SuppressFinalize(this);
}

private static void Dispose(bool disposing)
{
    // Check to see if Dispose has already been called.
    if (false == disposed)
    {
        // If disposing equals true, dispose all managed
        // and unmanaged resources.
        if (disposing)
        {
            // Dispose managed resources.
            currentLogStream.Dispose();
        }
    }
    disposed = true;
}

public static void Uninitialize()
{
    Dispose(true);
}


thanks in advance,
George
AnswerRe: implement IDisposable issue Pin
leppie26-Nov-08 2:02
leppie26-Nov-08 2: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.