不过我上面的文件是老版本了。
新版本:
namespace LostinetSample
{
using System;
using System.Collections;
using System.Reflection;
using System.Threading;
using System.Diagnostics;
/// <summary>
/// 使用HashCodeLock.Lock超时
/// </summary>
[Serializable] public sealed class HashCodeLockTimeoutException:Exception
{
internal HashCodeLockTimeoutException(string msg):base(msg){}
}
/// <summary>
/// 针对类型和值的锁
/// </summary>
public sealed class HashCodeLock : MarshalByRefObject
{
int timeout;
bool excep;
/// <summary>
/// 用30秒作为默认过期时间,并且超时引发异常
/// </summary>
public HashCodeLock():this(30000,true)
{
}