Skip to content

Helper for easy and elegant type conversions, taking care of nullable, enum, System.DBNull and other types inherit from System.IConvertible. The method tries to convert to the specified type; if the conversion fails, there is an option to define a fallback value to be returned as a result.

License

Notifications You must be signed in to change notification settings

soaresluciano/ConverterHelper

Repository files navigation

ConverterHelper

Build status codecov NuGet version

Helper for easy and elegant type conversions, taking care of nullables, enums, System.DBNull and other types inherit from System.IConvertible. The method tries to convert to the specified type; if the conversion fails, there is an option to define a fallback value to be returned as a result.

Example:

int converted = someObject.ConvertToOrDefault(-1);

About

Helper for easy and elegant type conversions, taking care of nullable, enum, System.DBNull and other types inherit from System.IConvertible. The method tries to convert to the specified type; if the conversion fails, there is an option to define a fallback value to be returned as a result.

Topics

Resources

License

Stars

Watchers

Forks

Languages