PeterO.Cbor.CBORObject.AsSByte C# (CSharp) Method

AsSByte() private method

private AsSByte ( ) : sbyte
return sbyte
        public sbyte AsSByte()
        {
            int v = this.AsInt32();
              if (v > SByte.MaxValue || v < SByte.MinValue) {
            throw new OverflowException("This object's value is out of range");
              }
              return (sbyte)v;
        }

Usage Example

コード例 #1
0
 private static object TypeToIntegerObject(CBORObject objThis, Type t)
 {
     if (t.Equals(typeof(int)))
     {
         return(objThis.AsInt32());
     }
     if (t.Equals(typeof(short)))
     {
         return(objThis.AsInt16());
     }
     if (t.Equals(typeof(ushort)))
     {
         return(objThis.AsUInt16());
     }
     if (t.Equals(typeof(byte)))
     {
         return(objThis.AsByte());
     }
     if (t.Equals(typeof(sbyte)))
     {
         return(objThis.AsSByte());
     }
     if (t.Equals(typeof(long)))
     {
         return(objThis.AsInt64());
     }
     if (t.Equals(typeof(uint)))
     {
         return(objThis.AsUInt32());
     }
     if (t.Equals(typeof(ulong)))
     {
         return(objThis.AsUInt64());
     }
     throw new CBORException("Type not supported");
 }
All Usage Examples Of PeterO.Cbor.CBORObject::AsSByte