本文介绍了我怎样才能使依赖的判决等于零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! class AAA { public int X {get;组; } public int Y {get;组; } } class程序 { static void Main(string [] args) { AAA obj = new AAA() ; Fun(ref obj); } static void Fun(ref AAA _Obj) { AAA NewObj = null; NewObj = _Obj; NewObj = null; //我如何设置obj等于null } } 解决方案 如上所述,将上面的代码更改为 静态 void 乐趣( ref AAA _Obj) { _Obj = null ; } class AAA { public int X { get; set; } public int Y { get; set; } } class Program { static void Main(string[] args) { AAA obj = new AAA(); Fun( ref obj); } static void Fun(ref AAA _Obj) { AAA NewObj=null; NewObj = _Obj; NewObj = null; //how i can set obj equal null } } 解决方案As already suggested, change the above code tostatic void Fun(ref AAA _Obj) { _Obj = null; } 这篇关于我怎样才能使依赖的判决等于零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!