ch2_08.cs
来自「《c#技术内幕代码》」· CS 代码 · 共 49 行
CS
49 行
using System;
class CH2_8
{
static int ReferenceCount;
private static void IncrementReferenceCount()
{
// Here we would do any synchronization needed
// for multi-threaded apps.
ReferenceCount++;
Console.WriteLine("IncrementReferenceCount {0}", ReferenceCount);
// Here we would release the synchronization flag
}
private static void DecrementReferenceCount()
{
// Here we would do any synchronization needed
// for multi-threaded apps.
ReferenceCount--;
Console.WriteLine("DecrementReferenceCount {0}", ReferenceCount);
// Here we would release the synchronization flag
}
public CH2_8()
{
IncrementReferenceCount();
}
~CH2_8()
{
DecrementReferenceCount();
}
void Dispose()
{
Finalize();
GC.SuppressFinalize(this);
}
public static void Main()
{
CH2_8 app = new CH2_8();
app.Dispose();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?