EasyTypeCastHelper 1.0.2
dotnet add package EasyTypeCastHelper --version 1.0.2
NuGet\Install-Package EasyTypeCastHelper -Version 1.0.2
<PackageReference Include="EasyTypeCastHelper" Version="1.0.2" />
<PackageVersion Include="EasyTypeCastHelper" Version="1.0.2" />
<PackageReference Include="EasyTypeCastHelper" />
paket add EasyTypeCastHelper --version 1.0.2
#r "nuget: EasyTypeCastHelper, 1.0.2"
#:package EasyTypeCastHelper@1.0.2
#addin nuget:?package=EasyTypeCastHelper&version=1.0.2
#tool nuget:?package=EasyTypeCastHelper&version=1.0.2
EasyTypeCastHelper
EasyTypeCastHelper is a lightweight utility library designed to simplify type casting in your projects. It provides a set of helper functions to safely and efficiently cast between different types in C#.
Features
- Safe type casting with null checks.
- Support for common type conversions.
- Easy-to-use API for developers.
Installation
Add the nuget package to your project by
dotnet add package EasyTypeCastHelper
or via nuget package console
NuGet\Install-Package EasyTypeCastHelper
Usage
Example
using EasyTypeCastHelper;
class Program
{
static void Main(string[] args)
{
string value = "123";
int result = value.ToInt();
Console.WriteLine(result); // Output: 123
int? myNullable = value.ToNullableInt();
string? withDefaultValue = null;
int? nullable2 = withDefaultValue.ToNullableInt(500);
//All nullable methods have an defaultValue parameter. So if the source value is null it returns the default value set by you (defaults to NULL)
Console.WriteLine($"{nullable2}"); // output: 500
// The StringHelper also provides for number conversion (all number types e.g. int, long, short, uint, ulong etc...)
// NumberStyles and CultureInfo parameters
// Default:
// NumberStyles = Any
// CulureInfo = InvariantCulture
// JSON Helper
// Uses System.Text.Json
Test o = new() { Test = true };
string json = o.ToJson();
Console.WriteLine(json); // Output {"Test": true}
Test t2 = json.DeserializeFromJson<Test>();
}
private class Test {
public bool Test {get; set;}
}
}
API Documentation
(Note: Docs are generated by AI using the XML Doc comments from the source code)
DecimalExtensions
The DecimalExtensions class provides extension methods for converting decimal and decimal? values to various types.
Methods
ToBool(this decimal value)Converts adecimalvalue to abool.ToNullableBool(this decimal? value, bool? defaultValue = null)Converts a nullabledecimalvalue to a nullablebool. Returns thedefaultValueif the input isnull.ToUInt(this decimal value)Converts adecimalvalue to anuint.ToUInt(this decimal? value, uint? defaultValue = null)Converts a nullabledecimalvalue to a nullableuint. Returns thedefaultValueif the input isnull.ToUShort(this decimal value)Converts adecimalvalue to aushort.ToUShort(this decimal? value, ushort? defaultValue = null)Converts a nullabledecimalvalue to a nullableushort. Returns thedefaultValueif the input isnull.ToShort(this decimal value)Converts adecimalvalue to ashort.ToShort(this decimal? value, short? defaultValue = null)Converts a nullabledecimalvalue to a nullableshort. Returns thedefaultValueif the input isnull.ToULong(this decimal value)Converts adecimalvalue to aulong.ToULong(this decimal? value, ulong? defaultValue = null)Converts a nullabledecimalvalue to a nullableulong. Returns thedefaultValueif the input isnull.ToInt(this decimal value)Converts adecimalvalue to anint.ToInt(this decimal? value, int? defaultValue = null)Converts a nullabledecimalvalue to a nullableint. Returns thedefaultValueif the input isnull.ToLong(this decimal value)Converts adecimalvalue to along.ToLong(this decimal? value, long? defaultValue = null)Converts a nullabledecimalvalue to a nullablelong. Returns thedefaultValueif the input isnull.ToFloat(this decimal value)Converts adecimalvalue to afloat.ToFloat(this decimal? value, float? defaultValue = null)Converts a nullabledecimalvalue to a nullablefloat. Returns thedefaultValueif the input isnull.ToDouble(this decimal value)Converts adecimalvalue to adouble.ToDouble(this decimal? value, double? defaultValue = null)Converts a nullabledecimalvalue to a nullabledouble. Returns the
DoubleExtensions
The DoubleExtensions class provides extension methods for converting double and double? values to various types.
Methods
ToUInt(this double value)Converts adoublevalue to auint.ToUInt(this double? value, uint? defaultValue = null)Converts a nullabledoublevalue to a nullableuint. Returns thedefaultValueif the input isnull.ToUShort(this double value)Converts adoublevalue to aushort.ToUShort(this double? value, ushort? defaultValue = null)Converts a nullabledoublevalue to a nullableushort. Returns thedefaultValueif the input isnull.ToShort(this double value)Converts adoublevalue to ashort.ToShort(this double? value, short? defaultValue = null)Converts a nullabledoublevalue to a nullableshort. Returns thedefaultValueif the input isnull.ToULong(this double value)Converts adoublevalue to aulong.ToULong(this double? value, ulong? defaultValue = null)Converts a nullabledoublevalue to a nullableulong. Returns thedefaultValueif the input isnull.ToInt(this double value)Converts adoublevalue to anint.ToInt(this double? value, int? defaultValue = null)Converts a nullabledoublevalue to a nullableint. Returns thedefaultValueif the input isnull.ToLong(this double value)Converts adoublevalue to along.ToLong(this double? value, long? defaultValue = null)Converts a nullabledoublevalue to a nullablelong. Returns thedefaultValueif the input isnull.ToFloat(this double value)Converts adoublevalue to afloat.ToFloat(this double? value, float? defaultValue = null)Converts a nullabledoublevalue to a nullablefloat. Returns thedefaultValueif the input isnull.ToDecimal(this double value)Converts adoublevalue to adecimal.ToDecimal(this double? value, decimal? defaultValue = null)Converts a nullabledoublevalue to a nullabledecimal. Returns thedefaultValueif the input isnull.ToTimeSpanFromSeconds(this double value)Converts adoublevalue to aTimeSpanrepresenting seconds.ToTimeSpanFromSeconds(this double? value, TimeSpan? defaultValue = null)Converts a nullabledoublevalue to a nullableTimeSpanrepresenting seconds. Returns thedefaultValueif the input isnull.ToTimeSpanFromMinutes(this double value)Converts adoublevalue to aTimeSpanrepresenting minutes.ToTimeSpanFromMinutes(this double? value, TimeSpan? defaultValue = null)Converts a nullabledoublevalue to a nullableTimeSpanrepresenting minutes. Returns thedefaultValueif the input isnull.ToTimeSpanFromHours(this double value)Converts adoublevalue to aTimeSpanrepresenting hours.ToTimeSpanFromHours(this double? value, TimeSpan? defaultValue = null)Converts a nullabledoublevalue to a nullableTimeSpanrepresenting hours. Returns thedefaultValueif the input isnull.ToTimeSpanFromDays(this double value)Converts adoublevalue to aTimeSpanrepresenting days.ToTimeSpanFromDays(this double? value, TimeSpan? defaultValue = null)Converts a nullabledoublevalue to a nullableTimeSpanrepresenting days. Returns thedefaultValueif the input isnull.ToTimeSpanFromMilliseconds(this double value)Converts adoublevalue to aTimeSpanrepresenting milliseconds.ToTimeSpanFromMilliseconds(this double? value, TimeSpan? defaultValue = null)Converts a nullabledoublevalue to a nullableTimeSpanrepresenting milliseconds. Returns thedefaultValueif the input isnull.ToDateTimeFromUnixTimestamp(this double value)Converts adoublevalue representing a Unix timestamp (in seconds) to aDateTime.ToDateTimeFromUnixTimestamp(this double? value, DateTime? defaultValue = null)Converts a nullabledoublevalue representing a Unix timestamp (in seconds) to a nullableDateTime. Returns thedefaultValueif the input isnull.ToDateTimeFromUnixTimestampMilliseconds(this double value)Converts adoublevalue representing a Unix timestamp (in milliseconds) to aDateTime.ToDateTimeFromUnixTimestampMilliseconds(this double? value, DateTime? defaultValue = null)Converts a nullabledoublevalue representing a Unix timestamp (in milliseconds) to a nullableDateTime. Returns thedefaultValueif the input isnull.ToDateTimeFromTicks(this double value)Converts adoublevalue representing ticks to aDateTime.ToDateTimeFromTicks(this double? value, DateTime? defaultValue = null)Converts a nullabledoublevalue representing ticks to a nullableDateTime. Returns thedefaultValueif the input isnull.
IntExtensions
The IntExtensions class provides extension methods for converting int and int? values to various types.
Methods
ToUInt(this int value)Converts anintvalue to auint.ToUInt(this int? value, uint? defaultValue = null)Converts a nullableintvalue to a nullableuint. Returns thedefaultValueif the input isnull.ToULong(this int value)Converts anintvalue to aulong.ToULong(this int? value, ulong? defaultValue = null)Converts a nullableintvalue to a nullableulong. Returns thedefaultValueif the input isnull.ToShort(this int value)Converts anintvalue to ashort.ToShort(this int? value, short? defaultValue = null)Converts a nullableintvalue to a nullableshort. Returns thedefaultValueif the input isnull.ToUShort(this int value)Converts anintvalue to aushort.ToUShort(this int? value, ushort? defaultValue = null)Converts a nullableintvalue to a nullableushort. Returns thedefaultValueif the input isnull.ToLong(this int value)Converts anintvalue to along.ToLong(this int? value, long? defaultValue = null)Converts a nullableintvalue to a nullablelong. Returns thedefaultValueif the input isnull.ToDouble(this int value)Converts anintvalue to adouble.ToDouble(this int? value, double? defaultValue = null)Converts a nullableintvalue to a nullabledouble. Returns thedefaultValueif the input isnull.ToDecimal(this int value)Converts anintvalue to adecimal.ToDecimal(this int? value, decimal? defaultValue = null)Converts a nullableintvalue to a nullabledecimal. Returns thedefaultValueif the input isnull.ToBool(this int value)Converts anintvalue to abool. Returnstrueif the value is not zero, otherwisefalse.ToBool(this int? value, bool? defaultValue = null)Converts a nullableintvalue to a nullablebool. Returnstrueif the value is not zero,falseif it is zero, or thedefaultValueif the input isnull.ToTimeSpanFromSeconds(this int value)Converts anintvalue to aTimeSpanrepresenting seconds.ToTimeSpanFromSeconds(this int? value, TimeSpan? defaultValue = null)Converts a nullableintvalue to a nullableTimeSpanrepresenting seconds. Returns thedefaultValueif the input isnull.ToTimeSpanFromMinutes(this int value)Converts anintvalue to aTimeSpanrepresenting minutes.ToTimeSpanFromMinutes(this int? value, TimeSpan? defaultValue = null)Converts a nullableintvalue to a nullableTimeSpanrepresenting minutes. Returns thedefaultValueif the input isnull.ToTimeSpanFromHours(this int value)Converts anintvalue to aTimeSpanrepresenting hours.ToTimeSpanFromHours(this int? value, TimeSpan? defaultValue = null)Converts a nullableintvalue to a nullableTimeSpanrepresenting hours. Returns thedefaultValueif the input isnull.ToTimeSpanFromDays(this int value)Converts anintvalue to aTimeSpanrepresenting days.ToTimeSpanFromDays(this int? value, TimeSpan? defaultValue = null)Converts a nullableintvalue to a nullableTimeSpanrepresenting days. Returns thedefaultValueif the input isnull.ToDateTimeFromUnixTimestamp(this int value)Converts anintvalue representing a Unix timestamp (in seconds) to aDateTime.ToDateTimeFromUnixTimestamp(this int? value, DateTime? defaultValue = null)Converts a nullableintvalue representing a Unix timestamp (in seconds) to a nullableDateTime. Returns thedefaultValueif the input isnull.ToDateTimeFromUnixTimestampMilliseconds(this int value)Converts anintvalue representing a Unix timestamp (in milliseconds) to aDateTime.ToDateTimeFromUnixTimestampMilliseconds(this int? value, DateTime? defaultValue = null)Converts a nullableintvalue representing a Unix timestamp (in milliseconds) to a nullableDateTime. Returns thedefaultValueif the input isnull.ToDateTimeFromTicks(this int value)Converts anintvalue representing ticks to aDateTime.ToDateTimeFromTicks(this int? value, DateTime? defaultValue = null)Converts a nullableintvalue representing ticks to a nullableDateTime. Returns thedefaultValueif the input isnull.
LongExtensions
The LongExtensions class provides extension methods for converting long and long? values to various types.
Methods
ToUInt(this long value)Converts alongvalue to auint.ToUInt(this long? value, uint? defaultValue = null)Converts a nullablelongvalue to a nullableuint. Returns thedefaultValueif the input isnull.ToULong(this long value)Converts alongvalue to aulong.ToULong(this long? value, ulong? defaultValue = null)Converts a nullablelongvalue to a nullableulong. Returns thedefaultValueif the input isnull.ToShort(this long value)Converts alongvalue to ashort.ToShort(this long? value, short? defaultValue = null)Converts a nullablelongvalue to a nullableshort. Returns thedefaultValueif the input isnull.ToUShort(this long value)Converts alongvalue to aushort.ToUShort(this long? value, ushort? defaultValue = null)Converts a nullablelongvalue to a nullableushort. Returns thedefaultValueif the input isnull.ToInt(this long value)Converts alongvalue to anint.ToInt(this long? value, int? defaultValue = null)Converts a nullablelongvalue to a nullableint. Returns thedefaultValueif the input isnull.ToDouble(this long value)Converts alongvalue to adouble.ToDouble(this long? value, double? defaultValue = null)Converts a nullablelongvalue to a nullabledouble. Returns thedefaultValueif the input isnull.ToFloat(this long value)Converts alongvalue to afloat.ToFloat(this long? value, float? defaultValue = null)Converts a nullablelongvalue to a nullablefloat. Returns thedefaultValueif the input isnull.ToDecimal(this long value)Converts alongvalue to adecimal.ToDecimal(this long? value, decimal? defaultValue = null)Converts a nullablelongvalue to a nullabledecimal. Returns thedefaultValueif the input isnull.ToTimeSpanFromSeconds(this long value)Converts alongvalue to aTimeSpanrepresenting seconds.ToTimeSpanFromSeconds(this long? value, TimeSpan? defaultValue = null)Converts a nullablelongvalue to a nullableTimeSpanrepresenting seconds. Returns thedefaultValueif the input isnull.ToTimeSpanFromMinutes(this long value)Converts alongvalue to aTimeSpanrepresenting minutes.ToTimeSpanFromMinutes(this long? value, TimeSpan? defaultValue = null)Converts a nullablelongvalue to a nullableTimeSpanrepresenting minutes. Returns thedefaultValueif the input isnull.ToTimeSpanFromHours(this long value)Converts alongvalue to aTimeSpanrepresenting hours.ToTimeSpanFromHours(this long? value, TimeSpan? defaultValue = null)Converts a nullablelongvalue to a nullableTimeSpanrepresenting hours. Returns thedefaultValueif the input isnull.ToTimeSpanFromDays(this long value)Converts alongvalue to aTimeSpanrepresenting days.ToTimeSpanFromDays(this long? value, TimeSpan? defaultValue = null)Converts a nullablelongvalue to a nullableTimeSpanrepresenting days. Returns thedefaultValueif the input isnull.ToDateTimeFromUnixTimestamp(this long value)Converts alongvalue representing a Unix timestamp (in seconds) to aDateTime.ToDateTimeFromUnixTimestamp(this long? value, DateTime? defaultValue = null)Converts a nullablelongvalue representing a Unix timestamp (in seconds) to a nullableDateTime. Returns thedefaultValueif the input isnull.ToDateTimeFromUnixTimestampMilliseconds(this long value)Converts alongvalue representing a Unix timestamp (in milliseconds) to aDateTime.ToDateTimeFromUnixTimestampMilliseconds(this long? value, DateTime? defaultValue = null)Converts a nullablelongvalue representing a Unix timestamp (in milliseconds) to a nullableDateTime. Returns thedefaultValueif the input isnull.ToDateTimeFromTicks(this long value)Converts alongvalue representing ticks to aDateTime.ToDateTimeFromTicks(this long? value, DateTime? defaultValue = null)Converts a nullablelongvalue representing ticks to a nullableDateTime. Returns thedefaultValueif the input isnull.
ObjectExtensions
The ObjectExtensions class provides extension methods for object serialization.
Methods
ToNullableJson(this object value, JsonSerializerOptions? options = null)Serializes the specified object to a JSON string. If the object isnull, it returnsnull.- Parameters:
value: The object to serialize.options: Optional JSON serializer options.
- Returns: A JSON string representation of the object, or
nullif the object isnull.
- Parameters:
ToJson(this object? value, JsonSerializerOptions? options = null)Serializes the specified object to a JSON string if it is notnull.- Parameters:
value: The object to serialize, ornull.options: Optional JSON serializer options.
- Returns: A JSON string representation of the object, or
nullif the object isnull.
- Parameters:
ShortExtensions
The ShortExtensions class provides extension methods for converting short and short? values to various types.
Methods
ToLong(this short value)Converts ashortvalue to along.ToLong(this short? value, long? defaultValue = null)Converts a nullableshortvalue to a nullablelong. Returns thedefaultValueif the input isnull.ToDouble(this short value)Converts ashortvalue to adouble.ToDouble(this short? value, double? defaultValue = null)Converts a nullableshortvalue to a nullabledouble. Returns thedefaultValueif the input isnull.ToDecimal(this short value)Converts ashortvalue to adecimal.ToDecimal(this short? value, decimal? defaultValue = null)Converts a nullableshortvalue to a nullabledecimal. Returns thedefaultValueif the input isnull.ToInt(this short value)Converts ashortvalue to anint.ToInt(this short? value, int? defaultValue = null)Converts a nullableshortvalue to a nullableint. Returns thedefaultValueif the input isnull.ToShort(this short value)Converts ashortvalue to ashort.ToShort(this short? value, short? defaultValue = null)Converts a nullableshortvalue to a nullableshort. Returns thedefaultValueif the input isnull.ToUShort(this short value)Converts ashortvalue to aushort.ToUShort(this short? value, ushort? defaultValue = null)Converts a nullableshortvalue to a nullableushort. Returns thedefaultValueif the input isnull.ToBool(this short value)Converts ashortvalue to abool.ToBool(this short? value, bool? defaultValue = null)Converts a nullableshortvalue to a nullablebool. Returns thedefaultValueif the input isnull.
StringExtensions
The StringExtensions class provides extension methods for converting strings to various types.
Methods
ToInt(this string? value, int defaultValue = 0)
Converts the string to an integer. Returns thedefaultValueif the conversion fails.ToNullableInt(this string? value, int? defaultValue = null)
Converts the string to a nullable integer. Returns thedefaultValueif the conversion fails.ToDouble(this string? value, double defaultValue = 0.0, NumberStyles numberStyles = NumberStyles.Any, CultureInfo? cultureInfo = null)
Converts the string to a double. Returns thedefaultValueif the conversion fails.ToNullableDouble(this string? value, double? defaultValue = null, NumberStyles numberStyles = NumberStyles.Any, CultureInfo? cultureInfo = null)
Converts the string to a nullable double. Returns thedefaultValueif the conversion fails.ToBool(this string? value, bool defaultValue = false)
Converts the string to a boolean. Returns thedefaultValueif the conversion fails.ToNullableBool(this string? value, bool? defaultValue = null)
Converts the string to a nullable boolean. Returns thedefaultValueif the conversion fails.ToDateTime(this string? value, DateTime defaultValue, DateTimeStyles dateTimeStyles = DateTimeStyles.None, CultureInfo? cultureInfo = null)
Converts the string to aDateTime. Returns thedefaultValueif the conversion fails.ToNullableDateTime(this string? value, DateTime? defaultValue = null, DateTimeStyles dateTimeStyles = DateTimeStyles.None, CultureInfo? cultureInfo = null)
Converts the string to a nullableDateTime. Returns thedefaultValueif the conversion fails.ToGuid(this string? value, Guid defaultValue)
Converts the string to aGuid. Returns thedefaultValueif the conversion fails.ToNullableGuid(this string? value, Guid? defaultValue = null)
Converts the string to a nullableGuid. Returns thedefaultValueif the conversion fails.ToEnum<T>(this string? value, T defaultValue) where T : struct
Converts the string to an enum of typeT. Returns thedefaultValueif the conversion fails.ToNullableEnum<T>(this string? value, T? defaultValue = null) where T : struct
Converts the string to a nullable enum of typeT. Returns thedefaultValueif the conversion fails.DeserializeFromJson<T>(this string value, JsonSerializerOptions? options = null)
Deserializes the JSON string to an object of typeT.DeserializeFromNullableJson<T>(this string? value, T? defaultValue = default, JsonSerializerOptions? options = null)
Deserializes the JSON string to a nullable object of typeT. Returns thedefaultValueif the string isnull.
UintExtensions
The UintExtensions class provides extension methods for converting uint and uint? values to various types.
Methods
ToInt(this uint value)Converts auintvalue to anint.ToInt(this uint? value, int? defaultValue = null)Converts a nullableuintvalue to a nullableint. Returns thedefaultValueif the input isnull.ToShort(this uint value)Converts auintvalue to ashort.ToShort(this uint? value, short? defaultValue = null)Converts a nullableuintvalue to a nullableshort. Returns thedefaultValueif the input isnull.ToLong(this uint value)Converts auintvalue to along.ToLong(this uint? value, long? defaultValue = null)Converts a nullableuintvalue to a nullablelong. Returns thedefaultValueif the input isnull.ToDouble(this uint value)Converts auintvalue to adouble.ToDouble(this uint? value, double? defaultValue = null)Converts a nullableuintvalue to a nullabledouble. Returns thedefaultValueif the input isnull.ToDecimal(this uint value)Converts auintvalue to adecimal.ToDecimal(this uint? value, decimal? defaultValue = null)Converts a nullableuintvalue to a nullabledecimal. Returns thedefaultValueif the input isnull.ToULong(this uint value)Converts auintvalue to aulong.ToULong(this uint? value, ulong? defaultValue = null)Converts a nullableuintvalue to a nullableulong. Returns thedefaultValueif the input isnull.ToUShort(this uint value)Converts auintvalue to aushort.ToUShort(this uint? value, ushort? defaultValue = null)Converts a nullableuintvalue to a nullableushort. Returns thedefaultValueif the input isnull.ToBool(this uint value)Converts auintvalue to abool.ToBool(this uint? value, bool? defaultValue = null)Converts a nullableuintvalue to a nullablebool. Returns thedefaultValueif the input isnull.
ULongExtensions
The ULongExtensions class provides extension methods for converting ulong and ulong? values to various types.
Methods
ToLong(this ulong value)Converts aulongvalue to along.ToLong(this ulong? value, long? defaultValue = null)Converts a nullableulongvalue to a nullablelong. Returns thedefaultValueif the input isnull.ToDouble(this ulong value)Converts aulongvalue to adouble.ToDouble(this ulong? value, double? defaultValue = null)Converts a nullableulongvalue to a nullabledouble. Returns thedefaultValueif the input isnull.ToDecimal(this ulong value)Converts aulongvalue to adecimal.ToDecimal(this ulong? value, decimal? defaultValue = null)Converts a nullableulongvalue to a nullabledecimal. Returns thedefaultValueif the input isnull.ToInt(this ulong value)Converts aulongvalue to anint.ToInt(this ulong? value, int? defaultValue = null)Converts a nullableulongvalue to a nullableint. Returns thedefaultValueif the input isnull.ToShort(this ulong value)Converts aulongvalue to ashort.ToShort(this ulong? value, short? defaultValue = null)Converts a nullableulongvalue to a nullableshort. Returns thedefaultValueif the input isnull.ToULong(this ulong value)Converts aulongvalue to aulong.ToULong(this ulong? value, ulong? defaultValue = null)Converts a nullableulongvalue to a nullableulong. Returns thedefaultValueif the input isnull.ToUShort(this ulong value)Converts aulongvalue to aushort.ToUShort(this ulong? value, ushort? defaultValue = null)Converts a nullableulongvalue to a nullableushort. Returns thedefaultValueif the input isnull.ToBool(this ulong value)Converts aulongvalue to abool.ToBool(this ulong? value, bool? defaultValue = null)Converts a nullableulongvalue to a nullablebool. Returns thedefaultValueif the input isnull.
UShortExtensions
The UShortExtensions class provides extension methods for converting ushort and ushort? values to various types.
Methods
ToLong(this ushort value)Converts aushortvalue to along.ToLong(this ushort? value, long? defaultValue = null)Converts a nullableushortvalue to a nullablelong. Returns thedefaultValueif the input isnull.ToDouble(this ushort value)Converts aushortvalue to adouble.ToDouble(this ushort? value, double? defaultValue = null)Converts a nullableushortvalue to a nullabledouble. Returns thedefaultValueif the input isnull.ToDecimal(this ushort value)Converts aushortvalue to adecimal.ToDecimal(this ushort? value, decimal? defaultValue = null)Converts a nullableushortvalue to a nullabledecimal. Returns thedefaultValueif the input isnull.ToInt(this ushort value)Converts aushortvalue to anint.ToInt(this ushort? value, int? defaultValue = null)Converts a nullableushortvalue to a nullableint. Returns thedefaultValueif the input isnull.ToShort(this ushort value)Converts aushortvalue to ashort.ToShort(this ushort? value, short? defaultValue = null)Converts a nullableushortvalue to a nullableshort. Returns thedefaultValueif the input isnull.ToUShort(this ushort value)Converts aushortvalue to aushort.ToUShort(this ushort? value, ushort? defaultValue = null)Converts a nullableushortvalue to a nullableushort. Returns thedefaultValueif the input isnull.ToBool(this ushort value)Converts aushortvalue to abool.ToBool(this ushort? value, bool? defaultValue = null)Converts a nullableushortvalue to a nullablebool. Returns thedefaultValueif the input isnull.
Donate
You like this project? If you dont mind every "tip" is appreciated.
If you like to you can send an paypal donation* via
*Note: Not refund possible.
Contributing
Contributions are welcome! Please fork the repository and submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
* Added defaultValue to all nullable methods of StringExtensions
* Added examples
* Fixed code documentation
* Updated Readme
* Changed examples