CSharp examples for System:String Convert
String extension method which tries to convert the input string into Int16 representation.
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 w w .j a va 2 s .c o m*/ public class Main{ /// <summary> /// String extension method which tries to convert the input string into Int16 representation. /// </summary> /// <param name="input">The string on which the method is invoked.</param> /// <returns>Returns variable of type Int16 if the string is a number, null - otherwise.</returns> public static short ToShort(this string input) { short shortValue; short.TryParse(input, out shortValue); return shortValue; } }