TryParseSigned() public static method

public static TryParseSigned ( string s, long min, long max, long &value ) : bool
s string
min long
max long
value long
return bool
示例#1
0
 static byte[] TryParseInt64(string text, bool isBigEndian)
 {
     if (!NumberParser.TryParseSigned(text, long.MinValue, long.MaxValue, out long value))
     {
         return(null);
     }
     return(GetBytes((ulong)value, isBigEndian));
 }
示例#2
0
 static byte[]? TryParseInt16(string text, bool isBigEndian)
 {
     if (!NumberParser.TryParseSigned(text, short.MinValue, short.MaxValue, out long value))
     {
         return(null);
     }
     return(GetBytes((ushort)value, isBigEndian));
 }
示例#3
0
        static byte[] TryParseInt32(string text, bool isBigEndian)
        {
            long value;

            if (!NumberParser.TryParseSigned(text, int.MinValue, int.MaxValue, out value))
            {
                return(null);
            }
            return(GetBytes((uint)value, isBigEndian));
        }
示例#4
0
 static byte[] TryParseSByte(string text)
 {
     if (!NumberParser.TryParseSigned(text, sbyte.MinValue, sbyte.MaxValue, out long value))
     {
         return(null);
     }
     return(new byte[1] {
         (byte)value
     });
 }