eb9b72b0 f6ea f719 b0a0 22878b563467 - akesseler/Plexdata.CsvParser GitHub Wiki

TypeConverter.AsBoolean Method

This method converts given value into an object representing a Boolean type.

Namespace: Plexdata.CsvParser.Internals
Assembly: Plexdata.CsvParser.NET (in Plexdata.CsvParser.NET.dll) Version: 1.1.3+d5bef99aa35461ce4bafadf0bf2c2aeca18044ea

Syntax

C#

private static Object AsBoolean(
	string value,
	bool exactly,
	bool nullable,
	CultureInfo culture,
	CsvMappings mapping
)

Parameters

 

value
Type: System.String
The value to be converted.
exactly
Type: System.Boolean
If true, a Format Exception is thrown in case of a conversion was impossible. Otherwise the Max Value is returned in such a case.
nullable
Type: System.Boolean
Indicates whether given type is of type Nullable.
culture
Type: System.Globalization.CultureInfo
The culture information to be used for conversion.
mapping
Type: Plexdata.CsvParser.Processors.CsvMappings
The mapping to be used for value transformation.

Return Value

Type: Object
An object representing the type-save version of converted value. A return value of Max Value may indicate a conversion error.

Exceptions

 

Exception Condition
FormatException This exception is throw in case of a conversion has failed, but only if exactly is true.

Remarks

The method returns a value of 'true' as soon es given string contains either 'true' or '1'. The 'false' check instead is performed by verifying if given value contains either 'false' or '0'. In other cases, as for example error cases, false is returned or an exception is thrown if 'exactly' is enabled.

A value of is returned if given value is 'null' or 'empty' and its type is of type Nullable.

See Also

Reference

TypeConverter Class
Plexdata.CsvParser.Internals Namespace

⚠️ **GitHub.com Fallback** ⚠️