How GC collects resources in a static member in C#?
- by carter-boater
Dear all,
I have a piece of code like this:
Class Program
{
static StreamReader sr = null;
static int var=0;
static Program()
{
sr = new StreamReader("input.txt")
}
~Program()
{
sr.Dispose();
}
static void main(string args[])
{
//do something with input here
}
}
This may not be a good practice, but I just want to use this example to ask how…