Does the DoSomething() method cause memory leakage?
public static class AppContext
{
public static int ApplicationStateId {get; set}
...
}
public class MyService
{
public void DoSomething()
{
....
if(AppContext.ApplicationStateId == 1)
{
//do something
}
}
}
var service = new MyService();
service.DoSomething();
This means that static variables and everything they reference will never be garbage collected.
Michael said in 8 Ways You can Cause Memory Leaks in .NET.