CSharpSourceEmitter.SourceEmitter.UnboxToULong C# (CSharp) Method

UnboxToULong() private static method

private static UnboxToULong ( object obj ) : ulong
obj object
return ulong
    private static ulong UnboxToULong(object obj) {
      // Can't just cast - must unbox to specific type.
      // Can't use Convert.ToUInt64 - it'll throw for negative numbers
      switch (Convert.GetTypeCode(obj)) {
        case TypeCode.Byte:
          return (ulong)(Byte)obj;
        case TypeCode.SByte:
          return (ulong)(Byte)(SByte)obj;
        case TypeCode.UInt16:
          return (ulong)(UInt16)obj;
        case TypeCode.Int16:
          return (ulong)(UInt16)(Int16)obj;
        case TypeCode.UInt32:
          return (ulong)(UInt32)obj;
        case TypeCode.Int32:
          return (ulong)(UInt32)(Int32)obj;
        case TypeCode.UInt64:
          return (ulong)obj;
        case TypeCode.Int64:
          return (ulong)(Int64)obj;
      }
      // Argument must be of integral type (not in message becaseu we don't want english strings in CCI)
      throw new ArgumentException();
    }
SourceEmitter