Click or drag to resize

ExtensionsConvertionsToBool Method

Converts a string to bool.

This will first try to compare the string to "true" or "y" and then to "false" or "n". If both fails then it will use TryParse(String, Boolean) to parse the string to bool. If that also fails then the string will be compared to "1".

Namespace:  Cauldron
Assembly:  Cauldron (in Cauldron.dll) Version: 3.2.0.1 (3.2.0.1)
Syntax
C#
public static bool ToBool(
	this string target
)

Parameters

target
Type: SystemString
The value to convert

Return Value

Type: Boolean
Returns true if the string is equivalent to true; otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type String. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentNullExceptiontarget is null
See Also