首页 新闻 赞助 找找看

一个类引用了静态资源

0
悬赏园豆:10 [已解决问题] 解决于 2015-08-08 12:44

 一个类Test和静态类StaticClass

public class Test{
  public int I;
  public object Obj;  
}

public static class StaticClass{
  public static int I = 1;
  public static object obj = new object();
}

使用Test

var testClass = new Test();
testClass.I = StaticClass.I;
testClass.Obj = StaticClass.obj;

那么释放testClass, 需要把testClass.I = 0 和 testClass.Obj = null 吗?

求指教~

C#
问题补充:

想了一下, testClass.I = 0应该是不需要的, 但是tsetClass.Obj还不能确定

xiezhenhao的主页 xiezhenhao | 初学一级 | 园豆:100
提问于:2015-08-08 11:50
< >
分享
最佳答案
0

用Diagnostic Tools看了下, 不需要断开静态对象的引用都释放了, 赞一个

xiezhenhao | 初学一级 |园豆:100 | 2015-08-08 12:44
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册