日期:2014-05-17 浏览次数:20858 次
public static implicit operator DBBool(bool x)
{
return x? dbTrue: dbFalse;
}
// Explicit conversion from DBBool to bool. Throws an
// exception if the given DBBool is dbNull, otherwise returns
// true or false:
public static explicit operator bool(DBBool x)
{
if (x.value == 0) throw new InvalidOperationException();
return x.value > 0;
}
// Equality operator. Returns dbNull if either operand is dbNull,
// otherwise returns dbTrue or dbFalse:
public static DBBool operator ==(DBBool x, DBBool y)
{
if (x.value == 0
------解决方案--------------------
y.value == 0) return dbNull;
return x.value == y.value? dbTrue: dbFalse;
}