CSharp examples for System:String Parse
Parse Bool
using System.Text; using System.Linq; using System;/*from w w w. j a v a 2 s .c o m*/ public class Main{ public static bool? ParseBool(this string src) { src = src.ToLowerInvariant(); switch (src) { case "na": return false; case "n/a": return false; case "yes": return true; case "no": return false; default: bool placeHolder; if (!bool.TryParse(src, out placeHolder)) return null; return placeHolder; } } }