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

C#

 
QuestionCould the GC collect a static variable? Pin
HosamAly25-Nov-08 3:15
HosamAly25-Nov-08 3:15 
AnswerRe: Could the GC collect a static variable? Pin
N a v a n e e t h25-Nov-08 3:22
N a v a n e e t h25-Nov-08 3:22 
GeneralRe: Could the GC collect a static variable? Pin
HosamAly25-Nov-08 3:23
HosamAly25-Nov-08 3:23 
QuestionRe: Could the GC collect a static variable? Pin
HosamAly25-Nov-08 3:40
HosamAly25-Nov-08 3:40 
AnswerRe: Could the GC collect a static variable? Pin
Simon P Stevens25-Nov-08 4:10
Simon P Stevens25-Nov-08 4:10 
GeneralRe: Could the GC collect a static variable? Pin
HosamAly25-Nov-08 20:15
HosamAly25-Nov-08 20:15 
GeneralRe: Could the GC collect a static variable? Pin
Simon P Stevens25-Nov-08 22:30
Simon P Stevens25-Nov-08 22:30 
GeneralRe: Could the GC collect a static variable? Pin
HosamAly28-Nov-08 21:56
HosamAly28-Nov-08 21:56 
Thanks a lot! I'll try to check with MSDN.

Meanwhile, I made this workaround, tried stopping it from within the debugger (to simulate AppDomainUnload), and it worked OK. I'm not sure how safe it is, but it seems to be working fine.
class MyApp {
    private static SafeHandle handle = new MyAppSafeHandle();
    public static KeepAlive() { GC.KeepAlive(handle); }
}
class MyLibSafeHandle : SafeHandle {
    public MyLibSafeHandle()
        : base(IntPtr.Zero, true)
    { MyApp.KeepAlive(); }

    protected override ReleaseHandle() {
        externRelease(handle);
        MyApp.KeepAlive();
    }
}



QuestionWebRequest.RequestUri Pin
Thekaninos25-Nov-08 2:39
Thekaninos25-Nov-08 2:39 
AnswerRe: WebRequest.RequestUri Pin
Ravi Bhavnani25-Nov-08 2:47
professionalRavi Bhavnani25-Nov-08 2:47 
AnswerRe: WebRequest.RequestUri Pin
Giorgi Dalakishvili25-Nov-08 2:48
mentorGiorgi Dalakishvili25-Nov-08 2:48 
AnswerRe: WebRequest.RequestUri Pin
Pr@teek B@h!25-Nov-08 3:21
Pr@teek B@h!25-Nov-08 3:21 
AnswerRe: WebRequest.RequestUri Pin
Thekaninos25-Nov-08 3:30
Thekaninos25-Nov-08 3:30 
Questionhow can i copy a file to somewhere in my hard disk? Pin
maifs25-Nov-08 2:19
maifs25-Nov-08 2:19 
AnswerRe: how can i copy a file to somewhere in my hard disk? Pin
Simon P Stevens25-Nov-08 2:25
Simon P Stevens25-Nov-08 2:25 
JokeRe: how can i copy a file to somewhere in my hard disk? Pin
Giorgi Dalakishvili25-Nov-08 2:32
mentorGiorgi Dalakishvili25-Nov-08 2:32 
GeneralRe: how can i copy a file to somewhere in my hard disk? Pin
Simon P Stevens25-Nov-08 3:09
Simon P Stevens25-Nov-08 3:09 
JokeRe: how can i copy a file to somewhere in my hard disk? Pin
Giorgi Dalakishvili25-Nov-08 3:13
mentorGiorgi Dalakishvili25-Nov-08 3:13 
GeneralRe: how can i copy a file to somewhere in my hard disk? Pin
Guffa25-Nov-08 14:11
Guffa25-Nov-08 14:11 
GeneralRe: how can i copy a file to somewhere in my hard disk? Pin
Giorgi Dalakishvili25-Nov-08 4:53
mentorGiorgi Dalakishvili25-Nov-08 4:53 
GeneralRe: how can i copy a file to somewhere in my hard disk? Pin
Simon P Stevens25-Nov-08 5:09
Simon P Stevens25-Nov-08 5:09 
GeneralRe: how can i copy a file to somewhere in my hard disk? Pin
maifs25-Nov-08 3:00
maifs25-Nov-08 3:00 
AnswerRe: how can i copy a file to somewhere in my hard disk? Pin
Giorgi Dalakishvili25-Nov-08 2:26
mentorGiorgi Dalakishvili25-Nov-08 2:26 
GeneralRe: how can i copy a file to somewhere in my hard disk? Pin
maifs25-Nov-08 3:03
maifs25-Nov-08 3:03 
GeneralRe: how can i copy a file to somewhere in my hard disk? Pin
Giorgi Dalakishvili25-Nov-08 3:06
mentorGiorgi Dalakishvili25-Nov-08 3:06 

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.