示例#1
0
 public bool IsAssignableTo(TypeContainer type)
 {
     if (type.GetCompactClsType().Equals(ReflectionHelper.ByteType))
     {
         return(m_value >= SByte.MinValue && m_value <= Byte.MaxValue);
     }
     else if (type.GetCompactClsType().Equals(ReflectionHelper.Int16Type))
     {
         if (type.GetAssignableFromType().Equals(typeof(UInt16)))
         {
             return(m_value >= UInt16.MinValue && m_value <= UInt16.MaxValue);
         }
         else
         {
             return(m_value >= Int16.MinValue && m_value <= Int16.MaxValue);
         }
     }
     else if (type.GetCompactClsType().Equals(ReflectionHelper.Int32Type))
     {
         if (type.GetAssignableFromType().Equals(typeof(UInt32)))
         {
             return(m_value >= UInt32.MinValue && m_value <= UInt32.MaxValue);
         }
         else
         {
             return(m_value >= Int32.MinValue && m_value <= Int32.MaxValue);
         }
     }
     else if (type.GetCompactClsType().Equals(ReflectionHelper.Int64Type))
     {
         if (type.GetAssignableFromType().Equals(typeof(UInt64)))
         {
             return(m_value >= UInt64.MinValue && m_value <= UInt64.MaxValue);
         }
         else
         {
             return(m_value >= Int64.MinValue && m_value <= Int64.MaxValue);
         }
     }
     else
     {
         return(false);
     }
 }