您的位置:首页 > 其它

8.4 Automatic memory management

2005-11-28 22:15 393 查看
8.4 Automatic memory management
Manual memory management requires developers to manage the allocation and
de-allocation of blocks of
memory. Manual memory management can be both time-consuming and difficult.
In C#, automatic memory
management is provided so that developers are freed from this burdensome
task. In the vast majority of
cases, automatic memory management increases code quality and enhances
developer productivity without
negatively impacting either expressiveness or performance.
The example
using System;
public class Stack
{
private Node first = null;
public bool Empty {
get {
return (first == null);
}
}
public object Pop() {
if (first == null)
throw new Exception("Can’t Pop from an empty Stack.");
else {
object temp = first.Value;
first = first.Next;
return temp;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: