System.Convert.Convert.ToInt16 C# (CSharp) Метод

ToInt16() публичный статический Метод

public static ToInt16 ( string value, int fromBase ) : short
value string
fromBase int
Результат short
		public static short ToInt16 (string value, int fromBase)
		{
			int result = ConvertFromBase (value, fromBase, false);
			if (fromBase != 10) {
				if (result > ushort.MaxValue) {
					throw new OverflowException ("Value was either too large or too small for an Int16.");
				}

				// note: no sign are available to detect negatives
				if (result > Int16.MaxValue) {
					// return negative 2's complement
					return Convert.ToInt16 (-(65536 - result));
				}
			}
			return Convert.ToInt16 (result);
		}

Same methods

Convert.Convert::ToInt16 ( System.DateTime value ) : short
Convert.Convert::ToInt16 ( bool value ) : short
Convert.Convert::ToInt16 ( byte value ) : short
Convert.Convert::ToInt16 ( char value ) : short
Convert.Convert::ToInt16 ( decimal value ) : short
Convert.Convert::ToInt16 ( double value ) : short
Convert.Convert::ToInt16 ( float value ) : short
Convert.Convert::ToInt16 ( int value ) : short
Convert.Convert::ToInt16 ( long value ) : short
Convert.Convert::ToInt16 ( object value ) : short
Convert.Convert::ToInt16 ( object value, IFormatProvider provider ) : short
Convert.Convert::ToInt16 ( sbyte value ) : short
Convert.Convert::ToInt16 ( short value ) : short
Convert.Convert::ToInt16 ( string value ) : short
Convert.Convert::ToInt16 ( string value, IFormatProvider provider ) : short
Convert.Convert::ToInt16 ( uint value ) : short
Convert.Convert::ToInt16 ( ulong value ) : short
Convert.Convert::ToInt16 ( ushort value ) : short