CodeExtensions 1.0.0

dotnet add package CodeExtensions --version 1.0.0
                    
NuGet\Install-Package CodeExtensions -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CodeExtensions" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodeExtensions" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="CodeExtensions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CodeExtensions --version 1.0.0
                    
#r "nuget: CodeExtensions, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CodeExtensions@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CodeExtensions&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=CodeExtensions&version=1.0.0
                    
Install as a Cake Tool

About

CodeExtensions provides extension methods for various type conversions and validations.

Key Features

Here’s a brief description of each method in the Extensions class: <ul> <li>IsNull(object value)</li> <i style="font-size: smaller;color:lightblue">Checks if the value is null or DBNull.</i></i> <li>ConvertToSQLString(this string str, AssignQuotes assignQuotes)</li> <i style="font-size: smaller;color:lightblue">Converts a string to a SQL-safe string, optionally wrapping it in single quotes.</i> <li>CheckGuid(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a Guid, or returns Guid.Empty if conversion fails.</i> <li>CheckGuidNullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable Guid, or returns null if conversion fails.</i> <li>CheckString(this object value, bool TrimAll = true)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a string, optionally trimming whitespace.</i> <li>CheckBoolean(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a bool, interpreting 1 as true for numeric types.</i> <li>CheckBooleanNullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable bool, or returns null if conversion fails.</i> <li>CheckByteArray(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a byte[] array, or returns null if not possible.</i> <li>CheckByte(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a byte, or returns 0 if conversion fails.</i> <li>CheckByteNullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable byte, or returns null if conversion fails.</i> <li>CheckChar(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a char, or returns '\0' if conversion fails.</i> <li>CheckCharNullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable char, or returns null if conversion fails.</i> <li>CheckCharArray(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a char[] array, or returns null if not possible.</i> <li>CheckDateNullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable DateTime, or returns null if conversion fails.</i> <li>CheckDate(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a DateTime, or returns the default value if conversion fails.</i> <li>CheckDateTimeOffset(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a DateTimeOffset, or returns the default value if conversion fails.</i> <li>CheckDateTimeOffsetNullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable DateTimeOffset, or returns null if conversion fails.</i> <li>CheckDecimal(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a decimal, or returns 0.0m if conversion fails.</i> <li>CheckDecimalNullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable decimal, or returns null if conversion fails.</i> <li>CheckDouble(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a double, or returns 0.0 if conversion fails.</i> <li>CheckDoubleNullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable double, or returns null if conversion fails.</i> <li>CheckFloat(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a float, or returns 0f if conversion fails.</i> <li>CheckFloatNullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable float, or returns null if conversion fails.</i> <li>CheckInteger(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to an int, or returns 0 if conversion fails.</i> <li>CheckIntegerNullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable int, or returns null if conversion fails.</i> <li>CheckInt16(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a short (Int16), or returns 0 if conversion fails.</i> <li>CheckInt16Nullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable short, or returns null if conversion fails.</i> <li>CheckInt32(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to an int (Int32), or returns 0 if conversion fails.</i> <li>CheckInt32Nullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable int (Int32), or returns null if conversion fails.</i> <li>CheckInt64(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a long (Int64), or returns 0L if conversion fails.</i> <li>CheckInt64Nullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable long (Int64), or returns null if conversion fails.</i> <li>CheckSByte(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to an sbyte, or returns 0 if conversion fails.</i> <li>CheckSByteNullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable sbyte, or returns null if conversion fails.</i> <li>CheckUInt16(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a uint, or returns 0u if conversion fails.</i> <li>CheckUInt16Nullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable uint, or returns null if conversion fails.</i> <li>CheckUInt32(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a ushort, or returns 0 if conversion fails.</i> <li>CheckUInt32Nullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable ushort, or returns null if conversion fails.</i> <li>CheckUInt64(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a ulong, or returns 0uL if conversion fails.</i> <li>CheckUInt64Nullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable ulong, or returns null if conversion fails.</i> <li>CheckTimeSpan(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a TimeSpan, or returns the default value if conversion fails.</i> <li>CheckTimeSpanNullable(this object value)</li> <i style="font-size: smaller;color:lightblue">Converts an object to a nullable TimeSpan, or returns null if conversion fails.</i> <li>ToDataTable<T>(this List<T> items)</li> <i style="font-size: smaller;color:lightblue">Converts a list of objects to a DataTable.</i> <li>DataTableToList<T>(this DataTable dt)</li> <i style="font-size: smaller;color:lightblue">Converts a DataTable to a list of objects of type T.</i> <li>GetDataRow<T>(DataRow dr)</li> <i style="font-size: smaller;color:lightblue">Converts a DataRow to an object of type T.</i> <li>ToEnum<T>(this string value)</li> <i style="font-size: smaller;color:lightblue">Converts a string to its enum equivalent of type T.</i> <li>ToShort(this string value)</li> <i style="font-size: smaller;color:lightblue">Converts a string to a short (returns 0 if not numeric).</i> <li>ToInteger(this string value)</li> <i style="font-size: smaller;color:lightblue">Converts a string to an int (returns 0 if not numeric).</i> <li>ToLong(this string value)</li> <i style="font-size: smaller;color:lightblue">Converts a string to a long (returns 0 if not numeric).</i> <li>IsValidYear(this Object obj)</li> <i style="font-size: smaller;color:lightblue">Checks if the object represents a valid year (from 1901 onward).</i> <li>IsDate(this Object obj)</li> <i style="font-size: smaller;color:lightblue">Checks if the object can be parsed as a valid date.</i> <li>IsDecimal(this string stringToTest)</li> <i style="font-size: smaller;color:lightblue">Checks if the string can be parsed as a decimal.</i> <li>IsDouble(this string stringToTest)</li> <i style="font-size: smaller;color:lightblue">Checks if the string can be parsed as a double.</i> <li>IsInteger(this string stringToTest)</li> <i style="font-size: smaller;color:lightblue">Checks if the string can be parsed as an integer.</i> <li>IsInt16(this string stringToTest)</li> <i style="font-size: smaller;color:lightblue">Checks if the string can be parsed as a short (Int16).</i> <li>IsInt32(this string stringToTest)</li> <i style="font-size: smaller;color:lightblue">Checks if the string can be parsed as an int (Int32).</i> <li>IsInt64(this string stringToTest)</li> <i style="font-size: smaller;color:lightblue">Checks if the string can be parsed as a long (Int64).</i> <li>IsNumeric(this string stringToTest, bool intOnly = false)</li> <i style="font-size: smaller;color:lightblue">Checks if the string is numeric (optionally only integer types).</i> <li>IsGuid(this Object obj)</li> <i style="font-size: smaller;color:lightblue">Checks if the object can be parsed as a Guid.</i> <li>IsIntGreaterThan(this string input, int value)</li> <i style="font-size: smaller;color:lightblue">Checks if the string represents an integer greater than the specified value.</i> <li>IsIntEqualTo(this string input, int value)</li> <i style="font-size: smaller;color:lightblue">Checks if the string represents an integer equal to the specified value.</i> <li>IsIntGreaterThanAndLessThan(this string input, int low, int high)</li> <i style="font-size: smaller;color:lightblue">Checks if the string represents an integer greater than low and less than high.</i> </ul>

LoneWorx.com

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.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.

Version Downloads Last Updated
1.0.0 49 5/31/2025