<PackageReference Include="Relativity.Server.Utility.SDK" Version="5000.2.1" />

kCura.Utility.NullableTypesHelper

public class NullableTypesHelper
Provides methods for converting nullable types.

public static object ConvertNullToDbNull(object val)

Converts a null value to dbNull if necessary. Does nothing otherwise.

public static object ConvertNullToDbNull<T>(T? val) where T : struct

Transforms the provided nullable, if it does not have a value, to DBNull.Value.

public static object ConvertNullToDbNull(string val)

Transforms the provided string, if it is Nothing, to DBNull.Value.

public static T? ConvertToNullableType<T>(object item) where T : struct

Casts the provided object to Nullable(of T).

public static object DBNullConvertFrom(object Item)

Verifies the provided item is not null. If it is, returns Value.

public static Guid DBNullConvertToGuid(object Item)

Casts the provided object, if it is not Value, to Guid.

public static int DBNullConvertToInt32(object Item)

public static long DBNullConvertToInt64(object Item)

public static T? DBNullConvertToNullable<T>(object Item) where T : struct

Casts the provided object, if it is not Value, to Nullable(of T).

public static T DBNullConvertToObject<T>(object Item)

Casts the provided object, if it is not Value, to T.

public static string DBNullGuidAsString(object Item)

Casts the provided object, if it is not Value, to a guid string.

public static T? DBNullOrNullConvertToNullable<T>(object Item) where T : struct

Casts the provided object, if it is not Nothing or Value, to Nullable(of T).

public static string DBNullOrNullToString(object item)

Casts the provided object, if it is not Value or Nothing, to a string.

public static string DBNullString(object item)

Casts the provided object, if it is not Value, to a string.

public static string ToEmptyStringOrValue(DateTime? convertMe, bool useUniversalFormat = false)

Casts the provided nullable date to a string.

public static string ToEmptyStringOrValue(decimal? convertMe)

Casts the provided nullable decimal to a string.

public static string ToEmptyStringOrValue(decimal? convertMe, string format)

Casts the provided nullable decimal to a string, utilizing the provided format string.

public static string ToEmptyStringOrValue(int? convertMe)

Casts the provided nullable integer to a string, utilizing the provided format string.

public static string ToEmptyStringOrValue(bool? convertMe)

Casts the provided nullable boolean to a string, utilizing the provided format string.

public static string ToEmptyStringOrValue(string convertMe)

Casts the provided string to String.Empty if it is null.

public static bool? ToNullableBoolean(string convertMe)

Casts the provided string to a nullable boolean.

public static DateTime? ToNullableDateTime(string convertMe, bool useUniversalFormat = false)

Casts the provided string to a nullable date, utilizing the provided format string.

public static decimal? ToNullableDecimal(string convertMe, NumberStyles type = 367)

Casts the provided string to a nullable decimal, utilizing the provided format type.

public static decimal? ToNullableDecimalUsingCurrentCulture(string convertMe, NumberStyles type = 367)

public static int? ToNullableInt32(string convertMe)

Casts the provided string to a nullable integer.

public static long? ToNullableInt64(string convertMe)

Casts the provided string to a nullable long.

public static int? ToNullableTypeID(int id)

If id is 0 or negative, returns null. Otherwise return the value of id.

public static string ToString(string convertMe)

Gets the string representation of the provided string.