本文整理汇总了C#中System.Variant.GetR4FromVar方法的典型用法代码示例。如果您正苦于以下问题:C# Variant.GetR4FromVar方法的具体用法?C# Variant.GetR4FromVar怎么用?C# Variant.GetR4FromVar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Variant
的用法示例。
在下文中一共展示了Variant.GetR4FromVar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Equals
public bool Equals(Variant v) {
int cvtype = CVType;
if (cvtype == CV_ENUM) {
if (v.CVType != CV_ENUM || v.m_objref != m_objref)
return false;
cvtype = MapEnumToCVType(EnumType);
}
else {
if (v.CVType != cvtype) {
return false;
}
}
switch (cvtype) {
case CV_BOOLEAN:
return m_data1==v.m_data1;
case CV_I1:
case CV_U1:
return ((byte)m_data1==(byte)v.m_data1);
case CV_I2:
case CV_U2:
case CV_CHAR:
return ((short)m_data1==(short)v.m_data1);
case CV_I4:
case CV_U4:
return (m_data1==v.m_data1);
case CV_I8:
case CV_U8:
case CV_DATETIME:
case CV_TIMESPAN:
case CV_CURRENCY:
// Bitwise equality is correct for all these types.
return (m_data1==v.m_data1 && m_data2==v.m_data2);
case CV_R4:
// For R4 and R8, must compare as fp values to handle Not-a-Number.
return GetR4FromVar()==v.GetR4FromVar();
case CV_R8:
// For R4 and R8, must compare as fp values to handle Not-a-Number.
return GetR8FromVar()==v.GetR8FromVar();
case CV_STRING:
case CV_DECIMAL:
case CV_OBJECT:
// If we have a null objref, it is equal to another object
// iff the other object is null.
if (m_objref==null)
return (v.m_objref==null);
return m_objref.Equals(v.m_objref);
case CV_EMPTY:
case CV_MISSING:
// Missing is a "flag" Variant that can't be directly instantiated.
// Therefore two missings are always equal.
return true;
case CV_NULL:
// Spec now says database NULL's never equal one another.
return false;
default:
return false;
}
}