System.ObjectExtentions.ToBool C# (CSharp) Method

ToBool() public static method

Convert an object to a boolean
public static ToBool ( this foo ) : bool
foo this
return bool
        public static bool ToBool(this object foo)
        {
            if (foo.IsNull())
                return false;
            else
            {
                var tmp = new[] { "on" }.Contains(foo) ? true : foo;
                return Convert.ToBoolean(tmp);
            }
        }