CSharp examples for System:Int32
Convert String to Int Value Or Default
using System.Text; using System.IO;//from w w w . j a va 2 s. co m using System.Globalization; using System.Collections.Generic; using System; public class Main{ public static int IntValueOrDefault(this string value, int defaultValue) { int result; if (int.TryParse(value, out result)) { return result; } else { return defaultValue; } } }