本文介绍了在c#中使用有什么意义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 您好, 昨天我遇到了伪代码: string s; 使用(新的ClassA(你好)) { for(int i = 0; i< some_count; i ++) s =a; s = null; } Class ClassA(字符串数据):IDisposable { public void Dispose() { //// /做一些处理 } } 有人可以解释一下在这里使用关键字的意义吗? 谢谢和问候Hello, I came across a pseudo code yesterday : string s; using(new ClassA("hello")) { for(int i =0 ; i < some_count; i++) s = "a"; s=null; } Class ClassA(string data) : IDisposable { public void Dispose() { /////do some disposal } } can someone please explain me the significance of Using keyword here? Thanks and Regards推荐答案 CP有一篇很棒的文章基础帮助解决这些问题。看看了解C#中的'using'语句 [ ^ ]文章。CP has a great article base to help with questions like these. Take a look at Understanding the 'using' statement in C#[^] article.查看此链接 http://msdn.microsoft.com/en-us/library/yh598w02.aspx [ ^ ]请参考以下链接: Link1 [ ^ ] 链路2 [ ^ ] Link3 [ ^ ]Please refer the following links :Link1[^]Link2[^]Link3[^] 这篇关于在c#中使用有什么意义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-01 22:35