CSharp examples for System:String Convert
Converts the string representation of a number to its 16-bit signed integer equivalent. If the conversion failed the return value is 0.
using System.Text.RegularExpressions; using System.Text; using System.Security.Cryptography; using System.Linq; using System.Globalization; using System.Collections.Generic; using System;//from w ww . j a va 2s .c om public class Main{ /// <summary> /// Converts the string representation of a number to its 16-bit signed integer /// equivalent. If the conversion failed the return value is 0. /// </summary> /// <returns>System.Int16</returns> public static short ToShort(this string input) { short shortValue; short.TryParse(input, out shortValue); return shortValue; } }