Skip to content

DiGi.Core

github-actions[bot] edited this page Jul 15, 2026 · 2 revisions

DiGi.Core Namespace

Classes

Convert Class

public static class Convert

Inheritance System.Object → Convert

Methods

Convert.ToDiGi(this Color) Method

Converts a System.Drawing.Color to a DiGi-compatible Color.

public static DiGi.Core.Classes.Color ToDiGi(this System.Drawing.Color color);

Parameters

color System.Drawing.Color

The source color to convert.

Returns

Color
A DiGi-compatible Color object.

Convert.ToDiGi<T>(byte[]) Method

Deserializes a byte array into a list of objects of type T.

public static System.Collections.Generic.List<T>? ToDiGi<T>(byte[]? bytes)
    where T : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

T

The type of elements in the list.

Parameters

bytes System.Byte[]

The byte array to deserialize.

Returns

System.Collections.Generic.List<T>
A list of objects of type T, or null if deserialization fails.

Convert.ToDiGi<T>(Path) Method

Loads and deserializes a list of objects of type T from the specified path.

public static System.Collections.Generic.List<T>? ToDiGi<T>(DiGi.Core.Classes.Path path)
    where T : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

T

The type of elements in the list.

Parameters

path Path

The path to the source data.

Returns

System.Collections.Generic.List<T>
A list of objects of type T, or null if loading fails.

Convert.ToDiGi<T>(string) Method

Deserializes a JSON string into a list of objects of type T.

public static System.Collections.Generic.List<T>? ToDiGi<T>(string? json)
    where T : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

T

The type of elements in the list.

Parameters

json System.String

The JSON string to deserialize.

Returns

System.Collections.Generic.List<T>
A list of objects of type T, or null if deserialization fails.

Convert.ToDrawing(int, byte) Method

Converts an int color value (RGB) to a System.Drawing.Color with optional alpha.

public static System.Drawing.Color ToDrawing(int @int, byte alpha=byte.MaxValue);

Parameters

int System.Int32

The integer RGB color value.

alpha System.Byte

The alpha channel value.

Returns

System.Drawing.Color
The converted System.Drawing.Color.

Convert.ToDrawing(string) Method

Converts a color string (named, hex, or alpha hex) to a System.Drawing.Color.

public static System.Drawing.Color ToDrawing(string? value);

Parameters

value System.String

The color string to convert.

Returns

System.Drawing.Color
The converted System.Drawing.Color, or Color.Empty if parsing fails.

Convert.ToDrawing(this Color) Method

Converts a DiGi.Core.Classes.Color to a System.Drawing.Color.

public static System.Drawing.Color ToDrawing(this DiGi.Core.Classes.Color? color);

Parameters

color Color

The color to convert.

Returns

System.Drawing.Color
The converted System.Drawing.Color.

Convert.ToDrawing(uint) Method

Converts a uint color value (ARGB) to a System.Drawing.Color.

public static System.Drawing.Color ToDrawing(uint @uint);

Parameters

uint System.UInt32

The unsigned integer ARGB color value.

Returns

System.Drawing.Color
The converted System.Drawing.Color.

Convert.ToJson(this ISerializableObject) Method

Converts a serializable object to a JsonObject.

public static System.Text.Json.Nodes.JsonObject? ToJson(this DiGi.Core.Interfaces.ISerializableObject? serializableObject);

Parameters

serializableObject ISerializableObject

The serializable object to convert.

Returns

System.Text.Json.Nodes.JsonObject
A System.Text.Json.Nodes.JsonObject representation of the object, or null if the input is null.

Convert.ToJson<T>(this IEnumerable<T>) Method

Converts a collection of serializable objects to a JsonArray.

public static System.Text.Json.Nodes.JsonArray? ToJson<T>(this System.Collections.Generic.IEnumerable<T>? serializableObjects)
    where T : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

T

The type of elements in the collection.

Parameters

serializableObjects System.Collections.Generic.IEnumerable<T>

The collection of serializable objects to convert.

Returns

System.Text.Json.Nodes.JsonArray
A System.Text.Json.Nodes.JsonArray containing the serialized objects, or null if the input is null.

Convert.ToSystem<T>(this Range<T>, T) Method

Converts a range of values into a system list with a specified step.

public static System.Collections.Generic.List<T>? ToSystem<T>(this DiGi.Core.Classes.Range<T>? range, T step);

Type parameters

T

The type of elements in the range.

Parameters

range DiGi.Core.Classes.Range<T>

The range to convert.

step T

The step value used for conversion.

Returns

System.Collections.Generic.List<T>
A list containing the values from the range, or null if the range is null.

Convert.ToSystem_Bytes(this ISerializableObject) Method

Converts a serializable object to its UTF-8 byte representation.

public static byte[]? ToSystem_Bytes(this DiGi.Core.Interfaces.ISerializableObject? serializableObject);

Parameters

serializableObject ISerializableObject

The serializable object to convert.

Returns

System.Byte[]
A byte array representing the UTF-8 encoded data, or null if the input is null.

Convert.ToSystem_Bytes<T>(this IEnumerable<T>) Method

Converts a collection of serializable objects to their UTF-8 byte representation.

public static byte[]? ToSystem_Bytes<T>(this System.Collections.Generic.IEnumerable<T>? serializableObjects)
    where T : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

T

The type of elements in the collection.

Parameters

serializableObjects System.Collections.Generic.IEnumerable<T>

The collection of serializable objects to convert.

Returns

System.Byte[]
A byte array representing the UTF-8 encoded data, or null if the input is null.

Convert.ToSystem_Dictionary<T,X>(this IEnumerable<X>, Func<X,T>) Method

Converts a collection of values into a dictionary where each key is associated with a list of values produced by the key function.

public static System.Collections.Generic.Dictionary<T,System.Collections.Generic.List<X>>? ToSystem_Dictionary<T,X>(this System.Collections.Generic.IEnumerable<X> values, System.Func<X,T?> keyFunc);

Type parameters

T

The type of keys in the resulting dictionary.

X

The type of elements in the input collection.

Parameters

values System.Collections.Generic.IEnumerable<X>

The collection of values to convert.

keyFunc System.Func<X,T>

A function to extract the key for each element.

Returns

System.Collections.Generic.Dictionary<T,System.Collections.Generic.List<X>>
A dictionary containing lists of values grouped by the keys produced by the key function, or null if the input is null.

Convert.ToSystem_FileInfo(this ISerializableObject, Nullable<Path>) Method

Serializes a serializable object to a file and returns the FileInfo.

public static System.IO.FileInfo? ToSystem_FileInfo(this DiGi.Core.Interfaces.ISerializableObject? serializableObject, System.Nullable<DiGi.Core.Classes.Path> path);

Parameters

serializableObject ISerializableObject

The serializable object to serialize.

path System.Nullable<Path>

The destination path for the serialized file.

Returns

System.IO.FileInfo
A System.IO.FileInfo object representing the created file, or null if the operation failed.

Convert.ToSystem_FileInfo<T>(this IEnumerable<T>, Nullable<Path>) Method

Serializes a collection of serializable objects to a file and returns the FileInfo.

public static System.IO.FileInfo? ToSystem_FileInfo<T>(this System.Collections.Generic.IEnumerable<T>? serializableObjects, System.Nullable<DiGi.Core.Classes.Path> path)
    where T : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

T

The type of elements in the collection.

Parameters

serializableObjects System.Collections.Generic.IEnumerable<T>

The collection of serializable objects to serialize.

path System.Nullable<Path>

The destination path for the serialized file.

Returns

System.IO.FileInfo
A System.IO.FileInfo object representing the created file, or null if the operation failed.

Convert.ToSystem_String(this TypeReference, string, string) Method

Formats a type reference and unique identifier into a system string.

public static string? ToSystem_String(this DiGi.Core.Classes.TypeReference? typeReference, string? uniqueId, string? format);

Parameters

typeReference TypeReference

The type reference to format.

uniqueId System.String

The unique identifier for the type.

format System.String

The format string to use.

Returns

System.String
The formatted system string, or null if applicable.

Convert.ToSystem_String(this ISerializableObject) Method

Converts a serializable object to its JSON string representation using default options.

public static string? ToSystem_String(this DiGi.Core.Interfaces.ISerializableObject? serializableObject);

Parameters

serializableObject ISerializableObject

The serializable object to convert.

Returns

System.String
A JSON string representation of the object, or null if the input is null.

Convert.ToSystem_String(this ISerializableObject, JsonSerializerOptions) Method

Converts a serializable object to its JSON string representation using specified options.

public static string? ToSystem_String(this DiGi.Core.Interfaces.ISerializableObject? serializableObject, System.Text.Json.JsonSerializerOptions? jsonSerializerOptions);

Parameters

serializableObject ISerializableObject

The serializable object to convert.

jsonSerializerOptions System.Text.Json.JsonSerializerOptions

The options to use for JSON serialization.

Returns

System.String
A JSON string representation of the object, or null if applicable.

Convert.ToSystem_String(this ISerializableReference, string) Method

Converts a serializable reference to its system string representation with an optional source.

public static string? ToSystem_String(this DiGi.Core.Interfaces.ISerializableReference? serializableReference, string? source);

Parameters

serializableReference ISerializableReference

The serializable reference to convert.

source System.String

The optional source string.

Returns

System.String
The system string representation of the serializable reference, or null if applicable.

Convert.ToSystem_String(this IEnumerable<ISerializableObject>) Method

Converts a collection of serializable objects to a JSON string representation using default options.

public static string? ToSystem_String(this System.Collections.Generic.IEnumerable<DiGi.Core.Interfaces.ISerializableObject>? serializableObjects);

Parameters

serializableObjects System.Collections.Generic.IEnumerable<ISerializableObject>

The collection of serializable objects to convert.

Returns

System.String
A JSON string representation of the collection, or null if the input is null.

Convert.ToSystem_String(this IEnumerable<ISerializableObject>, JsonSerializerOptions) Method

Converts a collection of serializable objects to a JSON string representation using specified options.

public static string? ToSystem_String(this System.Collections.Generic.IEnumerable<DiGi.Core.Interfaces.ISerializableObject>? serializableObjects, System.Text.Json.JsonSerializerOptions? jsonSerializerOptions);

Parameters

serializableObjects System.Collections.Generic.IEnumerable<ISerializableObject>

The collection of serializable objects to convert.

jsonSerializerOptions System.Text.Json.JsonSerializerOptions

The options to use for JSON serialization.

Returns

System.String
A JSON string representation of the collection, or null if applicable.

Convert.ToSystem_String<T>(this IEnumerable<T>) Method

Converts a collection of objects implementing ISerializableObject to a JSON string representation using default options.

public static string? ToSystem_String<T>(this System.Collections.Generic.IEnumerable<T>? serializableObjects)
    where T : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

T

The type of elements in the collection.

Parameters

serializableObjects System.Collections.Generic.IEnumerable<T>

The collection of serializable objects to convert.

Returns

System.String
A JSON string representation of the collection, or null if the input is null.

Convert.ToSystem_String<USerializableObject>(this IEnumerable<USerializableObject>, JsonSerializerOptions) Method

Converts a collection of objects implementing ISerializableObject to a JSON string representation using specified options.

public static string? ToSystem_String<USerializableObject>(this System.Collections.Generic.IEnumerable<USerializableObject>? serializableObjects, System.Text.Json.JsonSerializerOptions? jsonSerializerOptions)
    where USerializableObject : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

USerializableObject

The type of the serializable objects in the collection.

Parameters

serializableObjects System.Collections.Generic.IEnumerable<USerializableObject>

The collection of serializable objects to convert.

jsonSerializerOptions System.Text.Json.JsonSerializerOptions

The options to use for JSON serialization.

Returns

System.String
A JSON string representation of the collection, or null if applicable.

Create Class

public static class Create

Inheritance System.Object → Create

Methods

Create.Array<T>(string, string, bool, T) Method

Creates a 2D array of values by reading and parsing a delimited text file.

public static T?[,]? Array<T>(string? path, string separator="\t", bool removeEmptyLines=true, T? @default=default(T?));

Type parameters

T

The type of the array elements.

Parameters

path System.String

The file path to read from.

separator System.String

The string used to separate values in each line.

removeEmptyLines System.Boolean

If true, ignores empty lines in the file.

default T

The default value to use if parsing fails.

Returns

T[]
A 2D array containing the parsed values, or null if the file is invalid.

Create.Category(this IEnumerable<string>) Method

Creates a hierarchical structure of Category objects from an enumerable sequence of names.

public static DiGi.Core.Classes.Category? Category(this System.Collections.Generic.IEnumerable<string>? names);

Parameters

names System.Collections.Generic.IEnumerable<System.String>

The sequence of names representing the category hierarchy.

Returns

Category
The root Category object, or null if the input is empty.

Create.CategoryPath(string) Method

Creates a CategoryPath object by parsing a string containing quoted names.

public static DiGi.Core.Classes.CategoryPath? CategoryPath(string text);

Parameters

text System.String

The string containing the category path.

Returns

CategoryPath
A CategoryPath object, or null if the string is invalid or empty.

Create.ConfigurationFile(string) Method

Creates a ConfigurationFile object by loading it from the specified path.

public static DiGi.Core.Classes.ConfigurationFile? ConfigurationFile(string? path);

Parameters

path System.String

The file path to the configuration file.

Returns

ConfigurationFile
A ConfigurationFile object loaded with data, or null if the file does not exist.

Create.Dictionary(Type, Type) Method

Creates a dictionary instance with the specified key and value types.

public static System.Collections.IDictionary? Dictionary(System.Type? key, System.Type? value);

Parameters

key System.Type

The type of keys in the dictionary.

value System.Type

The type of values in the dictionary.

Returns

System.Collections.IDictionary
An System.Collections.IDictionary instance created with the specified types, or null.

Create.Directory(string) Method

Creates the directory and its parent directories if they do not exist.

public static bool Directory(string? directory);

Parameters

directory System.String

The path to the directory to create.

Returns

System.Boolean
True if the directory was created or already exists; otherwise, false.

Create.Guid(this string) Method

Creates a unique GUID that is consistent for the same string

public static System.Guid Guid(this string? @string);

Parameters

string System.String

Returns

System.Guid
Unique Guid

Create.Guid<TUniqueObject>(this UniqueObjectValueCluster<TUniqueObject>, Type) Method

Creates a unique GUID for the specified type that does not exist in the given cluster.

public static System.Guid Guid<TUniqueObject>(this DiGi.Core.Classes.UniqueObjectValueCluster<TUniqueObject>? uniqueObjectValueCluster, System.Type? type)
    where TUniqueObject : DiGi.Core.Interfaces.IUniqueObject;

Type parameters

TUniqueObject

The type of the unique object value.

Parameters

uniqueObjectValueCluster DiGi.Core.Classes.UniqueObjectValueCluster<TUniqueObject>

The cluster used to ensure the generated GUID is unique.

type System.Type

The type for which the unique GUID is created.

Returns

System.Guid
A unique Guid(this string) that does not exist in the specified cluster.

Create.GuidReference<T>(this T, Func<T,Guid>) Method

Creates a GUID reference for the specified object using the given function to retrieve its GUID.

public static DiGi.Core.Classes.GuidReference? GuidReference<T>(this T? @object, System.Func<T?,System.Guid> func);

Type parameters

T

The type of the object.

Parameters

object T

The object for which to create a GUID reference.

func System.Func<T,System.Guid>

The function used to retrieve the GUID from the object.

Returns

GuidReference
A GuidReference if successful; otherwise, null.

Create.GuidReference<TUniqueObject>(this UniqueObjectValueCluster<TUniqueObject>, Type) Method

Creates a unique GUID reference for the specified type that does not exist in the given cluster.

public static DiGi.Core.Classes.GuidReference? GuidReference<TUniqueObject>(this DiGi.Core.Classes.UniqueObjectValueCluster<TUniqueObject>? uniqueObjectValueCluster, System.Type? type)
    where TUniqueObject : DiGi.Core.Interfaces.IUniqueObject;

Type parameters

TUniqueObject

The type of the unique object.

Parameters

uniqueObjectValueCluster DiGi.Core.Classes.UniqueObjectValueCluster<TUniqueObject>

The cluster to check for existing references.

type System.Type

The type for which to create a GUID reference.

Returns

GuidReference
A GuidReference if successful; otherwise, null.

Create.JsonNode(this object) Method

Creates a JSON node from the given object.

public static System.Text.Json.Nodes.JsonNode? JsonNode(this object? @object);

Parameters

object System.Object

The object to convert to a JSON node.

Returns

System.Text.Json.Nodes.JsonNode
A JsonNode(this object) representing the object, or null if the object is null.

Create.List(Type) Method

Creates a list instance of the specified type.

public static System.Collections.IList? List(System.Type? type);

Parameters

type System.Type

The type of elements in the list.

Returns

System.Collections.IList
A new System.Collections.IList instance, or null if the operation fails.

Create.LongProgressWrapper(this IProgress<long>, long) Method

Creates a wrapper for a long-based progress reporter.

public static DiGi.Core.Classes.LongProgressWrapper? LongProgressWrapper(this System.IProgress<long>? progress, long initialValue=0L);

Parameters

progress System.IProgress<System.Int64>

The progress reporter to wrap.

initialValue System.Int64

The initial value for the progress reporter.

Returns

LongProgressWrapper
A LongProgressWrapper(this IProgress<long>, long) instance, or null if the provided progress is null.

Create.MemoryStream(this string) Method

Creates a memory stream from the given string.

public static System.IO.MemoryStream? MemoryStream(this string? text);

Parameters

text System.String

The string to convert into a memory stream.

Returns

System.IO.MemoryStream
A System.IO.MemoryStream containing the text, or null if the input is null.

Create.MemoryStream(this IEnumerable<string>) Method

Creates a memory stream from the given collection of strings.

public static System.IO.MemoryStream? MemoryStream(this System.Collections.Generic.IEnumerable<string>? text);

Parameters

text System.Collections.Generic.IEnumerable<System.String>

The collection of strings to convert into a memory stream.

Returns

System.IO.MemoryStream
A System.IO.MemoryStream containing the text, or null if the input is null.

Create.Object<T>(object[]) Method

Creates an instance of the specified type using the provided arguments.

public static T? Object<T>(params object[] objects);

Type parameters

T

The type of the object to create.

Parameters

objects System.Object[]

The arguments to be passed to the constructor of the created object.

Returns

T
An instance of type T, or null if the operation fails.

Create.ObjectPath(string) Method

Creates an object path from the given text.

public static DiGi.Core.Classes.ObjectPath? ObjectPath(string? text);

Parameters

text System.String

The text to be converted into an object path.

Returns

ObjectPath
An ObjectPath(string) if successful; otherwise, null.

Create.ParallelOptions(double) Method

Creates parallel options based on the specified processor fraction.

public static System.Threading.Tasks.ParallelOptions ParallelOptions(double fraction=0.9);

Parameters

fraction System.Double

The fraction of available processors to be used for parallel operations.

Returns

System.Threading.Tasks.ParallelOptions
A ParallelOptions(double) instance configured with the specified fraction.

Create.Random(int) Method

Creates a random number generator with an optional seed.

public static System.Random Random(int seed=-1);

Parameters

seed System.Int32

The seed value for the random number generator. Defaults to -1.

Returns

System.Random
A new Random(int) instance.

Create.SerializableObject<T>(this JsonObject) Method

Creates a serializable object from the given JSON object.

public static T? SerializableObject<T>(this System.Text.Json.Nodes.JsonObject? jsonObject)
    where T : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

T

The type of the object to create.

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object to convert into a serializable object.

Returns

T
A serializable object of type T, or null if the conversion fails.

Create.SerializableObjects<T>(this JsonArray) Method

Creates a list of serializable objects from the given JSON array.

public static System.Collections.Generic.List<T>? SerializableObjects<T>(this System.Text.Json.Nodes.JsonArray? jsonArray)
    where T : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

T

The type of elements in the resulting list.

Parameters

jsonArray System.Text.Json.Nodes.JsonArray

The JSON array to be converted into a list of serializable objects.

Returns

System.Collections.Generic.List<T>
A list containing the deserialized objects of type T, or null if the input is null.

Create.SerializationConstructor(this Type) Method

Creates a serialization constructor for the specified type.

public static DiGi.Core.Classes.SerializationConstructor? SerializationConstructor(this System.Type? type);

Parameters

type System.Type

The type for which to create the serialization constructor.

Returns

SerializationConstructor
A SerializationConstructor(this Type) if successful; otherwise, null.

Create.SerializationMethodCollection(this Type) Method

Creates a serialization method collection for the specified type.

public static DiGi.Core.Classes.SerializationMethodCollection? SerializationMethodCollection(this System.Type? type);

Parameters

type System.Type

The type for which to create the serialization method collection.

Returns

SerializationMethodCollection
A SerializationMethodCollection(this Type) containing the serialization methods for the specified type, or null if none are found.

Create.TypeReference(this Type) Method

Creates a type reference for the specified type.

public static DiGi.Core.Classes.TypeReference? TypeReference(this System.Type? type);

Parameters

type System.Type

The type for which to create a type reference.

Returns

TypeReference
A type reference for the specified type, or null if the provided type is null.

Create.UniqueReference(this object) Method

Creates a unique reference for the specified object.

public static DiGi.Core.Classes.UniqueReference? UniqueReference(this object? @object);

Parameters

object System.Object

The object for which to create a unique reference.

Returns

UniqueReference
A unique reference for the specified object.

Create.UTC(double) Method

Creates a UTC offset from the given double value.

public static DiGi.Core.Enums.UTC UTC(double timeOffset);

Parameters

timeOffset System.Double

The double representation of the UTC offset.

Returns

UTC
A UTC instance representing the specified offset.

Create.UTC(float) Method

Creates a UTC offset from the given float value.

public static DiGi.Core.Enums.UTC UTC(float timeOffset);

Parameters

timeOffset System.Single

The float representation of the UTC offset.

Returns

UTC
A UTC instance representing the specified offset.

Create.UTC(string) Method

Creates a UTC offset from the given string value.

public static DiGi.Core.Enums.UTC UTC(string value);

Parameters

value System.String

The string representation of the UTC offset.

Returns

UTC
A UTC instance representing the specified offset.

Modify Class

public static class Modify

Inheritance System.Object → Modify

Methods

Modify.Add<T>(this List<T>, T, Func<T,bool>) Method

Adds item to the list if condition in func is not meet by any of item on the list

public static bool Add<T>(this System.Collections.Generic.List<T>? list, T item, System.Func<T,bool> func);

Type parameters

T

Item type

Parameters

list System.Collections.Generic.List<T>

List

item T

Item to be added

func System.Func<T,System.Boolean>

Condition

Returns

System.Boolean
True if item has been added

Modify.Append(this StringBuilder, Type) Method

Appends the full, formatted type name of a Type to the StringBuilder.

public static void Append(this System.Text.StringBuilder? stringBuilder, System.Type? type);

Parameters

stringBuilder System.Text.StringBuilder

The StringBuilder to append to.

type System.Type

The Type to format and append.

Modify.Extend<T>(this List<T>, int) Method

Extends list to given length (count) by adding values from start of the list

public static bool Extend<T>(this System.Collections.Generic.List<T>? list, int count);

Type parameters

T

List type

Parameters

list System.Collections.Generic.List<T>

List

count System.Int32

New length of the list

Returns

System.Boolean
True if new items added. False if list is longer than given count value, list is empty or null

Modify.FromJsonObject(this ISerializableObject, JsonObject) Method

Populates an ISerializableObject from a JSON object.

public static bool FromJsonObject(this DiGi.Core.Interfaces.ISerializableObject? serializableObject, System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

serializableObject ISerializableObject

The serializable object to populate.

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing the data.

Returns

System.Boolean
True if the object was successfully populated; otherwise, false.

Modify.MatchLength<T,X>(List<T>, List<X>) Method

Matches the length of two lists by duplicating elements cyclically from the shorter list to match the longer list.

public static bool MatchLength<T,X>(System.Collections.Generic.List<T>? list_1, System.Collections.Generic.List<X>? list_2);

Type parameters

T

The type of elements in the first list.

X

The type of elements in the second list.

Parameters

list_1 System.Collections.Generic.List<T>

The first list.

list_2 System.Collections.Generic.List<X>

The second list.

Returns

System.Boolean
True if lengths were successfully matched; otherwise, false.

Modify.ReleaseCOMObject(this object) Method

Releases all references to a COM object.

public static bool ReleaseCOMObject(this object? cOMObject);

Parameters

cOMObject System.Object

The COM object to release.

Returns

System.Boolean
True if the object was successfully released; otherwise, false.

Modify.Sort<T>(this List<T>, Func<T,IComparable>) Method

Sorts the elements of a list using a specified function to extract a comparable key.

public static void Sort<T>(this System.Collections.Generic.List<T>? list, System.Func<T,System.IComparable>? func);

Type parameters

T

The type of elements in the list.

Parameters

list System.Collections.Generic.List<T>

The list to sort.

func System.Func<T,System.IComparable>

A function to extract the comparable key from an element.

Query Class

Provides utility methods for querying and determining data types of objects and types.

public static class Query

Inheritance System.Object → Query

Methods

Query.AlmostEquals(this double, double, double) Method

Determines whether two double values are approximately equal within a specified tolerance.

public static bool AlmostEquals(this double value_1, double value_2, double tolerance=1E-06);

Parameters

value_1 System.Double

The first value to compare.

value_2 System.Double

The second value to compare.

tolerance System.Double

The maximum allowed difference between the values.

Returns

System.Boolean
True if the values are approximately equal; otherwise, false.

Query.AspectRatio(this double, double, bool) Method

Calculates the aspect ratio of two values.

public static double AspectRatio(this double value_1, double value_2, bool normalized=false);

Parameters

value_1 System.Double

The first value.

value_2 System.Double

The second value.

normalized System.Boolean

If true, returns the ratio of the smaller value to the larger value.

Returns

System.Double
The calculated aspect ratio, or NaN if inputs are invalid.

Query.BoundedIndex(this Range<int>, int) Method

Maps an out-of-bounds index back into the specified range using a wrap-around (circular) logic. If the index is within the range, it returns the index unchanged. If the range is null, returns System.Int32.MinValue.

public static int BoundedIndex(this DiGi.Core.Classes.Range<int>? range, int index);

Parameters

range DiGi.Core.Classes.Range<System.Int32>

The boundaries within which the index should be contained.

index System.Int32

The index to be evaluated or mapped.

Returns

System.Int32
The original index if it's within bounds; the wrapped index if it's outside; or System.Int32.MinValue if the range is null.

Query.BoundedIndex(this int, int) Method

Bounded index between 0 and count - 1

public static int BoundedIndex(this int count, int index);

Parameters

count System.Int32

Items count

index System.Int32

Index

Returns

System.Int32
BoundedIndex

Query.Checksum(this string) Method

Computes the MD5 checksum of a string.

public static string? Checksum(this string? value);

Parameters

value System.String

The string to compute the checksum for.

Returns

System.String
A string representing the MD5 checksum, or null if the input is null.

Query.Clamp<T>(this Range<T>, T, T) Method

Limits the values of a Range to be within the specified minimum and maximum values.

public static DiGi.Core.Classes.Range<T>? Clamp<T>(this DiGi.Core.Classes.Range<T>? range, T min, T max);

Type parameters

T

The type of the range elements.

Parameters

range DiGi.Core.Classes.Range<T>

The range to clamp.

min T

The minimal value.

max T

The maximal value.

Returns

DiGi.Core.Classes.Range<T>
A new Range clamped to the specified limits, or null if the input range is null.

Query.Clamp<T>(this T, T, T) Method

Limits given value to min and max

public static T Clamp<T>(this T value, T min, T max);

Type parameters

T

The type of the values being clamped.

Parameters

value T

Value to be clamped

min T

Minimal Value

max T

Maximal Value

Returns

T
Clamp value

Query.Clone<T>(this IEnumerable<T>) Method

Clones a sequence of serializable objects into a new list.

public static System.Collections.Generic.List<T?>? Clone<T>(this System.Collections.Generic.IEnumerable<T?>? serializableObjects)
    where T : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

T

The type of the serializable objects.

Parameters

serializableObjects System.Collections.Generic.IEnumerable<T>

The sequence of objects to clone.

Returns

System.Collections.Generic.List<T>
A new list containing the cloned objects, or null if the input is null.

Query.Clone<T>(this T[]) Method

Clones an array into a new array.

public static T?[]? Clone<T>(this T?[]? values);

Type parameters

T

The type of the array elements.

Parameters

values T[]

The array to clone.

Returns

T[]
A new array containing the cloned elements, or null if the input is null.

Query.Clone<TSerializableObject>(this TSerializableObject) Method

Creates a clone of a serializable object.

public static TSerializableObject? Clone<TSerializableObject>(this TSerializableObject? serializableObject)
    where TSerializableObject : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

TSerializableObject

The type of the serializable object.

Parameters

serializableObject TSerializableObject

The object to clone.

Returns

TSerializableObject
A cloned instance of the object, or default if cloning fails.

Query.CloneAndFilterNulls<T>(this IEnumerable<T>) Method

Clones a sequence of serializable objects and filters out any null results.

public static System.Collections.Generic.List<T>? CloneAndFilterNulls<T>(this System.Collections.Generic.IEnumerable<T?>? serializableObjects)
    where T : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

T

The type of the serializable objects.

Parameters

serializableObjects System.Collections.Generic.IEnumerable<T>

The sequence of objects to clone.

Returns

System.Collections.Generic.List<T>
A list of non-null cloned objects, or null if the input is null.

Query.Compare(this double, double, NumberComparisonType) Method

Compares two numbers using NumberComparisonType (Example: NumberComparisonType.Greater returns true if value_1 greater than value_2)

public static bool Compare(this double value_1, double value_2, DiGi.Core.Enums.NumberComparisonType numberComparisonType);

Parameters

value_1 System.Double

First value

value_2 System.Double

Second value

numberComparisonType NumberComparisonType

Number Comparison Type example Equals etc.

Returns

System.Boolean
Comparison Type Result

Query.Compare(this double, double, NumberComparisonType, double) Method

Compares two numbers using NumberComparisonType (Example: NumberComparisonType.Greater returns true if value_1 greater than value_2)

public static bool Compare(this double value_1, double value_2, DiGi.Core.Enums.NumberComparisonType numberComparisonType, double tolerance);

Parameters

value_1 System.Double

First value

value_2 System.Double

Second value

numberComparisonType NumberComparisonType

Number Comparison Type example Equals etc.

tolerance System.Double

Comparison tolerance

Returns

System.Boolean
Comparison Type Result

Query.Compare(this string, string, TextComparisonType, bool) Method

Compares two numbers using TextComparisonType (Example: TextComparisonType.StartsWith returns true if value_1 starts with value_2)

public static bool Compare(this string? value_1, string? value_2, DiGi.Core.Enums.TextComparisonType textComparisonType, bool caseSensitive=true);

Parameters

value_1 System.String

Base value to be checked, reference text ie.GUID to be found

value_2 System.String

Text to be checked ie. name containing GUID

textComparisonType TextComparisonType

Text Comparison Type

caseSensitive System.Boolean

Case Sensitive

Returns

System.Boolean
Bool

Query.Compare(this IEnumerable<double>, double, NumberComparisonType) Method

Compares a collection of doubles against a single double using the specified comparison type.

public static System.Collections.Generic.List<bool>? Compare(this System.Collections.Generic.IEnumerable<double>? values, double value, DiGi.Core.Enums.NumberComparisonType numberComparisonType);

Parameters

values System.Collections.Generic.IEnumerable<System.Double>

The collection of doubles to compare.

value System.Double

The double to compare against.

numberComparisonType NumberComparisonType

The numeric comparison type to use.

Returns

System.Collections.Generic.List<System.Boolean>
A list of booleans representing the comparison results.

Query.Compare(this IEnumerable<string>, string, TextComparisonType, bool) Method

Compares a collection of strings against a single string using the specified comparison type.

public static System.Collections.Generic.List<bool>? Compare(this System.Collections.Generic.IEnumerable<string>? values, string? value, DiGi.Core.Enums.TextComparisonType textComparisonType, bool caseSensitive=true);

Parameters

values System.Collections.Generic.IEnumerable<System.String>

The collection of strings to compare.

value System.String

The string to compare against.

textComparisonType TextComparisonType

The comparison type to use.

caseSensitive System.Boolean

Whether the comparison should be case sensitive.

Returns

System.Collections.Generic.List<System.Boolean>
A list of booleans representing the comparison results.

Query.Compare(this DateTime, DateTime, NumberComparisonType) Method

Compares two DateTimes using NumberComparisonType (Example: NumberComparisonType.Greater returns true if value_1 greater than value_2)

public static bool Compare(this System.DateTime value_1, System.DateTime value_2, DiGi.Core.Enums.NumberComparisonType numberComparisonType);

Parameters

value_1 System.DateTime

First value

value_2 System.DateTime

Second value

numberComparisonType NumberComparisonType

Number Comparison Type example Equals etc.

Returns

System.Boolean
Comparison Type Result

Query.Compress(this ISerializableObject) Method

Compresses an ISerializableObject into a Base64 encoded string.

public static string? Compress(this DiGi.Core.Interfaces.ISerializableObject? serializableObject);

Parameters

serializableObject ISerializableObject

The object to compress.

Returns

System.String
A compressed string, or null if the object is null.

Query.Compress(this string) Method

Source: https://stackoverflow\.com/questions/7343465/compression\-decompression\-string\-with\-c\-sharp

public static string? Compress(this string? @string);

Parameters

string System.String

String to be compressed

Returns

System.String
Compressed string

Query.Compress<T>(this IEnumerable<T>) Method

Compresses a collection of ISerializableObject into a Base64 encoded string.

public static string? Compress<T>(this System.Collections.Generic.IEnumerable<T>? serializableObject)
    where T : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

T

The type of the serializable objects.

Parameters

serializableObject System.Collections.Generic.IEnumerable<T>

The collection of objects to compress.

Returns

System.String
A compressed string, or null if the collection is null.

Query.CustomAttribute<TAttribute>(Enum) Method

Optimized retrieval of a custom attribute from an Enum value.

public static TAttribute? CustomAttribute<TAttribute>(System.Enum? @enum)
    where TAttribute : System.Attribute;

Type parameters

TAttribute

The type of the attribute to retrieve.

Parameters

enum System.Enum

The enum value to search for the attribute.

Returns

TAttribute
The specified attribute if found; otherwise, null.

Query.CustomAttribute<TAttribute>(Type, string) Method

Optimized retrieval of a custom attribute from a Type and member name.

public static TAttribute? CustomAttribute<TAttribute>(System.Type? type, string? text)
    where TAttribute : System.Attribute;

Type parameters

TAttribute

The type of the attribute to retrieve.

Parameters

type System.Type

The type containing the member.

text System.String

The name of the member from which to retrieve the attribute.

Returns

TAttribute
The specified attribute if found; otherwise, null.

Query.CustomAttribute<TAttribute>(this MemberInfo) Method

Efficiently retrieves a custom attribute from MemberInfo using generic reflection extensions.

public static TAttribute? CustomAttribute<TAttribute>(this System.Reflection.MemberInfo? memberInfo)
    where TAttribute : System.Attribute;

Type parameters

TAttribute

The type of the attribute to retrieve.

Parameters

memberInfo System.Reflection.MemberInfo

The member information to search for the attribute.

Returns

TAttribute
The specified attribute if found; otherwise, null.

Query.CustomTypeAttribute<TAttribute>(Type) Method

Retrieves an attribute from the Type level (e.g., for CategoryAttribute on Enum declaration).

public static TAttribute? CustomTypeAttribute<TAttribute>(System.Type? type)
    where TAttribute : System.Attribute;

Type parameters

TAttribute

The type of the attribute to retrieve.

Parameters

type System.Type

The type from which to retrieve the attribute.

Returns

TAttribute
The specified attribute if found; otherwise, null.

Query.DataType(this object) Method

Gets the DiGi.Core.Enums.DataType of the specified object.

public static DiGi.Core.Enums.DataType DataType(this object? @object);

Parameters

object System.Object

The object for which to get the data type.

Returns

DataType
The DiGi.Core.Enums.DataType of the specified object.

Query.DataType(this object, bool) Method

Gets the DiGi.Core.Enums.DataType of the specified object and determines if it is nullable.

public static DiGi.Core.Enums.DataType DataType(this object? @object, out bool nullable);

Parameters

object System.Object

The object for which to get the data type.

nullable System.Boolean

When this method returns, contains a boolean value indicating whether the type is nullable.

Returns

DataType
The DiGi.Core.Enums.DataType of the specified object.

Query.DataType(this Type) Method

Gets the DiGi.Core.Enums.DataType of the specified type.

public static DiGi.Core.Enums.DataType DataType(this System.Type? type);

Parameters

type System.Type

The type for which to get the data type.

Returns

DataType
The DiGi.Core.Enums.DataType of the specified type.

Query.DataType(this Type, bool) Method

Gets the DiGi.Core.Enums.DataType of the specified type and determines if it is nullable.

public static DiGi.Core.Enums.DataType DataType(this System.Type? type, out bool nullable);

Parameters

type System.Type

The type for which to get the data type.

nullable System.Boolean

When this method returns, contains a boolean value indicating whether the type is nullable.

Returns

DataType
The DiGi.Core.Enums.DataType of the specified type.

Query.DecimalPlacesCount(this double) Method

Counts the number of decimal places in a double value.

public static int DecimalPlacesCount(this double value);

Parameters

value System.Double

The value to evaluate.

Returns

System.Int32
The number of decimal places.

Query.Decompress(this string) Method

Source: https://stackoverflow\.com/questions/7343465/compression\-decompression\-string\-with\-c\-sharp

public static string? Decompress(this string? @string);

Parameters

string System.String

Compressed string to be decompressed

Returns

System.String
Decompressed string

Query.Decompress<T>(this string) Method

Decompresses a Base64 encoded string back into a collection of ISerializableObjects.

public static System.Collections.Generic.List<T>? Decompress<T>(this string? @string)
    where T : DiGi.Core.Interfaces.ISerializableObject;

Type parameters

T

The type of the serializable objects.

Parameters

string System.String

The string to decompress.

Returns

System.Collections.Generic.List<T>
A list of deserialized objects, or null if decompression fails.

Query.Default(this Type) Method

Returns the default value for a given Type.

public static object? Default(this System.Type? type);

Parameters

type System.Type

The type to get the default value for.

Returns

System.Object
The default value, or null for reference types.

Query.Description(this Enum) Method

Gets the description attribute of an enum value.

public static string? Description(this System.Enum? @enum);

Parameters

enum System.Enum

The enum value.

Returns

System.String
The description string, or the enum name if no attribute is found.

Query.Description(this Type) Method

Gets the description attribute of a Type.

public static string? Description(this System.Type? type);

Parameters

type System.Type

The type.

Returns

System.String
The description string, or the type name if no attribute is found.

Query.Directories(string) Method

Retrieves a list of all parent directories up to the root for a given directory path.

public static System.Collections.Generic.List<string>? Directories(string? directory);

Parameters

directory System.String

The starting directory path.

Returns

System.Collections.Generic.List<System.String>
A list of directory paths, or null if the path is invalid.

Query.Directories(DirectoryInfo) Method

Retrieves a list of all parent directories up to the root for a given DirectoryInfo.

public static System.Collections.Generic.List<string>? Directories(System.IO.DirectoryInfo? directoryInfo);

Parameters

directoryInfo System.IO.DirectoryInfo

The DirectoryInfo object.

Returns

System.Collections.Generic.List<System.String>
A list of directory paths, or null if the DirectoryInfo is null.

Query.Duplicate<TGuidObject>(this TGuidObject, Nullable<Guid>) Method

Creates a duplicate of an IGuidObject, optionally assigning it a new Guid.

public static TGuidObject? Duplicate<TGuidObject>(this TGuidObject? guidObject, System.Nullable<System.Guid> guid=null)
    where TGuidObject : DiGi.Core.Interfaces.IGuidObject;

Type parameters

TGuidObject

The type of the GUID object.

Parameters

guidObject TGuidObject

The object to duplicate.

guid System.Nullable<System.Guid>

The optional new GUID to assign to the duplicate.

Returns

TGuidObject
A duplicated object, or default if the duplication fails.

Query.Enum(string, Type) Method

Parses a string into an Enum value of the specified type.

public static System.Enum? Enum(string? text, System.Type? type);

Parameters

text System.String

The string representation of the Enum.

type System.Type

The Type of the Enum.

Returns

System.Enum
The parsed Enum value, or null if parsing fails.

Query.Enum<TEnum>(string) Method

Parses a string into a strongly-typed Enum value.

public static TEnum? Enum<TEnum>(string? text)
    where TEnum : System.Enum;

Type parameters

TEnum

The type of the Enum.

Parameters

text System.String

The string representation of the Enum.

Returns

TEnum
The parsed Enum value, or the 'Undefined' enum value if found, or default if parsing fails.

Query.Enum<TEnum>(string, TEnum) Method

Parses a string into a strongly-typed Enum value, providing a fallback default value.

public static TEnum? Enum<TEnum>(string? text, TEnum? @default)
    where TEnum : System.Enum;

Type parameters

TEnum

The type of the Enum.

Parameters

text System.String

The string representation of the Enum.

default TEnum

The default value to return if parsing fails.

Returns

TEnum
The parsed Enum value, or the default if parsing fails.

Query.Equals(this byte[], byte[]) Method

Compares two byte arrays for equality.

public static bool Equals(this byte[]? bytes_1, byte[]? bytes_2);

Parameters

bytes_1 System.Byte[]

The first byte array.

bytes_2 System.Byte[]

The second byte array.

Returns

System.Boolean
True if the arrays are equal; otherwise, false.

Query.Equals(this IEnumerable, IEnumerable) Method

Compares two non-generic IEnumerable collections for equality.

public static bool Equals(this System.Collections.IEnumerable? enumerable_1, System.Collections.IEnumerable? enumerable_2);

Parameters

enumerable_1 System.Collections.IEnumerable

The first collection.

enumerable_2 System.Collections.IEnumerable

The second collection.

Returns

System.Boolean
True if the collections contain the same elements in the same order; otherwise, false.

Query.Equals<T>(this IEnumerable<T>, IEnumerable<T>) Method

Compares two generic IEnumerable collections for equality.

public static bool Equals<T>(this System.Collections.Generic.IEnumerable<T>? enumerable_1, System.Collections.Generic.IEnumerable<T>? enumerable_2);

Type parameters

T

The type of the elements in the collections.

Parameters

enumerable_1 System.Collections.Generic.IEnumerable<T>

The first collection.

enumerable_2 System.Collections.Generic.IEnumerable<T>

The second collection.

Returns

System.Boolean
True if the collections contain the same elements in the same order; otherwise, false.

Query.ExtensionMethodInfos(Type) Method

Retrieves all public static extension methods from the current app domain assemblies.

public static System.Collections.Generic.List<System.Reflection.MethodInfo> ExtensionMethodInfos(System.Type? type=null);

Parameters

type System.Type

Optional. The type that the extension method extends.

Returns

System.Collections.Generic.List<System.Reflection.MethodInfo>
A list of MethodInfo objects representing the extension methods.

Query.Filter<T>(this IEnumerable<T>, Func<T,bool>, List<T>, List<T>) Method

Filters a sequence of values based on a predicate, splitting them into matching and non-matching lists.

public static bool Filter<T>(this System.Collections.Generic.IEnumerable<T>? values, System.Func<T?,bool> func, out System.Collections.Generic.List<T>? values_In, out System.Collections.Generic.List<T>? values_Out);

Type parameters

T

The type of elements in the sequence.

Parameters

values System.Collections.Generic.IEnumerable<T>

The sequence to filter.

func System.Func<T,System.Boolean>

The predicate function to test each element.

values_In System.Collections.Generic.List<T>

When this method returns, contains the elements that satisfied the condition.

values_Out System.Collections.Generic.List<T>

When this method returns, contains the elements that did not satisfy the condition.

Returns

System.Boolean
True if the filtering was successful; otherwise, false.

Query.FilterNulls<T>(this IEnumerable<T>) Method

Filters out null values from a sequence of items.

public static System.Collections.Generic.List<T>? FilterNulls<T>(this System.Collections.Generic.IEnumerable<T?>? values);

Type parameters

T

The type of the elements.

Parameters

values System.Collections.Generic.IEnumerable<T>

The sequence to filter.

Returns

System.Collections.Generic.List<T>
A list containing only the non-null elements, or null if the input is null.

Query.Find<T>(this IEnumerable<T>, Func<T,bool>) Method

Finds the first element in a sequence that satisfies a specified condition.

public static T? Find<T>(this System.Collections.Generic.IEnumerable<T?>? values, System.Func<T?,bool> func);

Type parameters

T

The type of the elements.

Parameters

values System.Collections.Generic.IEnumerable<T>

The sequence to search.

func System.Func<T,System.Boolean>

The predicate function.

Returns

T
The first element that matches the condition, or default if not found.

Query.Flatten(this JsonArray) Method

Flattens a nested JSON array into a single-dimensional JSON array.

public static System.Text.Json.Nodes.JsonArray? Flatten(this System.Text.Json.Nodes.JsonArray? jsonArray);

Parameters

jsonArray System.Text.Json.Nodes.JsonArray

The JSON array to flatten.

Returns

System.Text.Json.Nodes.JsonArray
A new flattened JSON array, or null if the input is null.

Query.FullName(this Enum) Method

Gets the full name of an enum value, including its full type name.

public static string? FullName(this System.Enum? @enum);

Parameters

enum System.Enum

The enum value.

Returns

System.String
The formatted full name string, or null if the input is null.

Query.FullTypeName(ISerializableObject) Method

Retrieves the full type name of an ISerializableObject.

public static string? FullTypeName(DiGi.Core.Interfaces.ISerializableObject? serializableObject);

Parameters

serializableObject ISerializableObject

The serializable object.

Returns

System.String
The full type name.

Query.FullTypeName(Type) Method

Retrieves the full, formatted type name of a Type.

public static string? FullTypeName(System.Type? type);

Parameters

type System.Type

The type.

Returns

System.String
The full type name.

Query.FullTypeName(this JsonObject) Method

Retrieves the full type name from a JsonObject.

public static string? FullTypeName(this System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object.

Returns

System.String
The full type name, or null if not found.

Query.HashCode(int[]) Method

Computes a hash code from an array of integers.

public static int HashCode(params int[]? values);

Parameters

values System.Int32[]

The values to hash.

Returns

System.Int32
The computed hash code.

Query.IsNullable(this Type) Method

Determines whether the specified type is nullable.

public static bool IsNullable(this System.Type type);

Parameters

type System.Type

The type to check.

Returns

System.Boolean
True if the type is nullable; otherwise, false.

Query.IsNumeric(this DataType) Method

Determines whether the specified DataType represents a numeric type.

public static bool IsNumeric(this DiGi.Core.Enums.DataType dataType);

Parameters

dataType DataType

The DataType to check.

Returns

System.Boolean
True if the DataType is numeric; otherwise, false.

Query.IsNumeric(this DataType, bool) Method

Determines whether the specified DataType represents a numeric type and checks if it's an integer.

public static bool IsNumeric(this DiGi.Core.Enums.DataType dataType, out bool isInteger);

Parameters

dataType DataType

The DataType to check.

isInteger System.Boolean

Out parameter indicating whether the numeric type is an integer.

Returns

System.Boolean
True if the DataType is numeric; otherwise, false.

Query.IsNumeric(this object) Method

Determines whether the specified object represents a numeric type.

public static bool IsNumeric(this object? @object);

Parameters

object System.Object

The object to check.

Returns

System.Boolean
True if the object is numeric; otherwise, false.

Query.IsNumeric(this object, bool) Method

Determines whether the specified object represents a numeric type and checks if it's an integer.

public static bool IsNumeric(this object? @object, out bool isInteger);

Parameters

object System.Object

The object to check.

isInteger System.Boolean

Out parameter indicating whether the numeric type is an integer.

Returns

System.Boolean
True if the object is numeric; otherwise, false.

Query.IsNumeric(this Type) Method

Determines whether the specified Type represents a numeric type.

public static bool IsNumeric(this System.Type? type);

Parameters

type System.Type

The type to check.

Returns

System.Boolean
True if the type is numeric; otherwise, false.

Query.IsNumeric(this Type, bool) Method

Determines whether the specified Type represents a numeric type and checks if it's an integer.

public static bool IsNumeric(this System.Type? type, out bool isInteger);

Parameters

type System.Type

The type to check.

isInteger System.Boolean

Out parameter indicating whether the numeric type is an integer.

Returns

System.Boolean
True if the type is numeric; otherwise, false.

Query.JsonValueKind(this object) Method

Determines the JsonValueKind of a given object.

public static System.Text.Json.JsonValueKind JsonValueKind(this object value);

Parameters

value System.Object

The object to evaluate.

Returns

System.Text.Json.JsonValueKind
The corresponding JsonValueKind.

Query.Lerp(this Color, Color, double) Method

Linearly interpolates between color_1 and color_2 by value Source: http://www\.java2s\.com/example/csharp/system\.drawing/lerp\-between\-two\-color\.html

public static System.Drawing.Color Lerp(this System.Drawing.Color color_1, System.Drawing.Color color_2, double value);

Parameters

color_1 System.Drawing.Color

Start Color

color_2 System.Drawing.Color

End Color

value System.Double

Lerp value (0-1)

Returns

System.Drawing.Color
Lerp Color

Query.Lerps(this Color, Color, int) Method

Creates list of colors being linearly interpolated between color_1 and color_2 by value

public static System.Collections.Generic.List<System.Drawing.Color>? Lerps(this System.Drawing.Color color_1, System.Drawing.Color color_2, int count);

Parameters

color_1 System.Drawing.Color

Start Color

color_2 System.Drawing.Color

End Color

count System.Int32

Number of colors

Returns

System.Collections.Generic.List<System.Drawing.Color>
Lerped Colors

Query.Next(this int, int) Method

Calculates the next index in a circular collection.

public static int Next(this int count, int index);

Parameters

count System.Int32

The total number of elements.

index System.Int32

The current index.

Returns

System.Int32
The next index, or -1 if invalid.

Query.Next<T>(this IEnumerable<T>, int) Method

Gets the next element in a sequence, wrapping around if necessary.

public static T? Next<T>(this System.Collections.Generic.IEnumerable<T?>? values, int index);

Type parameters

T

The type of elements in the sequence.

Parameters

values System.Collections.Generic.IEnumerable<T>

The sequence to search.

index System.Int32

The current index.

Returns

T
The next element, or default if the sequence is null or empty.

Query.Next<TEnum>(TEnum) Method

Gets the next value in an enum, wrapping around to the first if it's the last.

public static TEnum? Next<TEnum>(TEnum? @enum)
    where TEnum : System.Enum;

Type parameters

TEnum

The enum type.

Parameters

enum TEnum

The current enum value.

Returns

TEnum
The next enum value.

Query.Opposite(this NumberComparisonType) Method

Gets the opposite of the specified NumberComparisonType.

public static DiGi.Core.Enums.NumberComparisonType Opposite(this DiGi.Core.Enums.NumberComparisonType numberComparisonType);

Parameters

numberComparisonType NumberComparisonType

The number comparison type.

Returns

NumberComparisonType
The opposite NumberComparisonType.

Query.Opposite(this TextComparisonType) Method

Gets the opposite of the specified TextComparisonType.

public static DiGi.Core.Enums.TextComparisonType Opposite(this DiGi.Core.Enums.TextComparisonType textComparisonType);

Parameters

textComparisonType TextComparisonType

The text comparison type.

Returns

TextComparisonType
The opposite TextComparisonType.

Query.Previous(this int, int) Method

Calculates the previous index in a circular collection.

public static int Previous(this int count, int index);

Parameters

count System.Int32

The total number of elements.

index System.Int32

The current index.

Returns

System.Int32
The previous index, or -1 if invalid.

Query.Previous<T>(this IEnumerable<T>, int) Method

Gets the previous element in a sequence, wrapping around if necessary.

public static T? Previous<T>(this System.Collections.Generic.IEnumerable<T?>? values, int index);

Type parameters

T

The type of elements in the sequence.

Parameters

values System.Collections.Generic.IEnumerable<T>

The sequence to search.

index System.Int32

The current index.

Returns

T
The previous element, or default if the sequence is null or empty.

Query.Previous<TENum>(TENum) Method

Gets the previous value in an enum, wrapping around to the last if it's the first.

public static TENum? Previous<TENum>(TENum? @enum)
    where TENum : System.Enum;

Type parameters

TENum

The enum type.

Parameters

enum TENum

The current enum value.

Returns

TENum
The previous enum value.

Query.ProcessorCount(double) Method

Gets the calculated processor count based on a specified fraction.

public static int ProcessorCount(double fraction=1.0);

Parameters

fraction System.Double

The fraction of total processors to use.

Returns

System.Int32
The calculated number of processors.

Query.QuotedStrings(string, string) Method

Splits a string by a separator, respecting quoted sections.

public static System.Collections.Generic.List<string>? QuotedStrings(string? text, string separator=",");

Parameters

text System.String

The text to split.

separator System.String

The separator string.

Returns

System.Collections.Generic.List<System.String>
A list of extracted strings.

Query.Random(Range<double>, int, double) Method

Generates a random double within a Range struct using a seed.

public static double Random(DiGi.Core.Classes.Range<double>? range, int seed=-1, double tolerance=0.001);

Parameters

range DiGi.Core.Classes.Range<System.Double>

The range.

seed System.Int32

The seed.

tolerance System.Double

The tolerance.

Returns

System.Double
A random double.

Query.Random(Range<int>, int) Method

Generates a random integer within a Range struct using a seed.

public static int Random(DiGi.Core.Classes.Range<int>? range, int seed=-1);

Parameters

range DiGi.Core.Classes.Range<System.Int32>

The range.

seed System.Int32

The seed.

Returns

System.Int32
A random integer.

Query.Random(double, double, int, double) Method

Generates a random double using a seed.

public static double Random(double start, double end, int seed=-1, double tolerance=0.001);

Parameters

start System.Double

The start value.

end System.Double

The end value.

seed System.Int32

The seed.

tolerance System.Double

The tolerance.

Returns

System.Double
A random double.

Query.Random(int) Method

Generates a random boolean using a seed.

public static bool Random(int seed=-1);

Parameters

seed System.Int32

The seed.

Returns

System.Boolean
A random boolean.

Query.Random(int, int, int) Method

Generates a random integer within a range using a seed.

public static int Random(int start, int end, int seed=-1);

Parameters

start System.Int32

The start value.

end System.Int32

The end value.

seed System.Int32

The seed.

Returns

System.Int32
A random integer.

Query.Random(Random) Method

Generates a random boolean.

public static bool Random(System.Random? random);

Parameters

random System.Random

The Random instance.

Returns

System.Boolean
A random boolean.

Query.Random(Random, Range<double>, double) Method

Generates a random double within a Range struct.

public static double Random(System.Random? random, DiGi.Core.Classes.Range<double>? range, double tolerance=0.001);

Parameters

random System.Random

The Random instance.

range DiGi.Core.Classes.Range<System.Double>

The range.

tolerance System.Double

The tolerance.

Returns

System.Double
A random double.

Query.Random(Random, Range<int>) Method

Generates a random integer within a Range struct.

public static int Random(System.Random? random, DiGi.Core.Classes.Range<int>? range);

Parameters

random System.Random

The Random instance.

range DiGi.Core.Classes.Range<System.Int32>

The range.

Returns

System.Int32
A random integer.

Query.Random(Random, double, double, double) Method

Generates a random double within a range.

public static double Random(System.Random? random, double start, double end, double tolerance=0.001);

Parameters

random System.Random

The Random instance.

start System.Double

The start value.

end System.Double

The end value.

tolerance System.Double

The tolerance.

Returns

System.Double
A random double.

Query.Random(Random, int, int) Method

Generates a random integer within a range.

public static int Random(System.Random? random, int start, int end);

Parameters

random System.Random

The Random instance.

start System.Int32

The start value.

end System.Int32

The end value.

Returns

System.Int32
A random integer.

Query.Randoms(int, Range<double>, int, double) Method

Generates a list of random doubles within a specified Range using an optional seed.

public static System.Collections.Generic.List<double>? Randoms(int count, DiGi.Core.Classes.Range<double>? range, int seed=-1, double tolerance=0.001);

Parameters

count System.Int32

The number of random doubles to generate.

range DiGi.Core.Classes.Range<System.Double>

The range from which the random doubles are generated.

seed System.Int32

An optional seed for the random number generator.

tolerance System.Double

The tolerance value used during generation.

Returns

System.Collections.Generic.List<System.Double>
A list of random doubles, or null if generation fails.

Query.Randoms(int, Range<int>, int) Method

Generates a list of random integers within a specified Range using an optional seed.

public static System.Collections.Generic.List<int>? Randoms(int count, DiGi.Core.Classes.Range<int>? range, int seed=-1);

Parameters

count System.Int32

The number of random integers to generate.

range DiGi.Core.Classes.Range<System.Int32>

The range from which the random integers are generated.

seed System.Int32

An optional seed for the random number generator.

Returns

System.Collections.Generic.List<System.Int32>
A list of random integers, or null if generation fails.

Query.Randoms(int, double, double, int, double) Method

Generates a list of random doubles within a specified range using an optional seed.

public static System.Collections.Generic.List<double>? Randoms(int count, double start, double end, int seed=-1, double tolerance=0.001);

Parameters

count System.Int32

The number of random doubles to generate.

start System.Double

The start value of the range.

end System.Double

The end value of the range.

seed System.Int32

An optional seed for the random number generator.

tolerance System.Double

The tolerance value used during generation.

Returns

System.Collections.Generic.List<System.Double>
A list of random doubles, or null if generation fails.

Query.Randoms(int, int) Method

Generates a list of random booleans using an optional seed.

public static System.Collections.Generic.List<bool>? Randoms(int count, int seed=-1);

Parameters

count System.Int32

The number of random booleans to generate.

seed System.Int32

The seed for the random number generator. Defaults to -1.

Returns

System.Collections.Generic.List<System.Boolean>
A list of random booleans, or null if generation fails.

Query.Randoms(int, int, int, int) Method

Generates a list of random integers within a specified range using an optional seed.

public static System.Collections.Generic.List<int>? Randoms(int count, int start, int end, int seed=-1);

Parameters

count System.Int32

The number of random integers to generate.

start System.Int32

The inclusive lower bound of the range.

end System.Int32

The exclusive upper bound of the range.

seed System.Int32

The seed for the random number generator. Defaults to -1.

Returns

System.Collections.Generic.List<System.Int32>
A list of random integers, or null if generation fails.

Query.Randoms(int, Random) Method

Generates a list of random booleans using a provided Random instance.

public static System.Collections.Generic.List<bool>? Randoms(int count, System.Random? random);

Parameters

count System.Int32

The number of random booleans to generate.

random System.Random

The Random instance used to generate the values.

Returns

System.Collections.Generic.List<System.Boolean>
A list of random booleans, or null if generation fails.

Query.Randoms(int, Random, Range<double>, double) Method

Generates a list of random doubles within a specified Range using a provided Random instance.

public static System.Collections.Generic.List<double>? Randoms(int count, System.Random? random, DiGi.Core.Classes.Range<double>? range, double tolerance=0.001);

Parameters

count System.Int32

The number of random doubles to generate.

random System.Random

The Random instance to use for generation.

range DiGi.Core.Classes.Range<System.Double>

The range from which the random doubles are generated.

tolerance System.Double

The tolerance value used during generation.

Returns

System.Collections.Generic.List<System.Double>
A list of random doubles, or null if generation fails.

Query.Randoms(int, Random, Range<int>) Method

Generates a list of random integers within a specified Range using a provided Random instance.

public static System.Collections.Generic.List<int>? Randoms(int count, System.Random? random, DiGi.Core.Classes.Range<int>? range);

Parameters

count System.Int32

The number of random integers to generate.

random System.Random

The Random instance used to generate the values.

range DiGi.Core.Classes.Range<System.Int32>

The range within which the random integers should be generated.

Returns

System.Collections.Generic.List<System.Int32>
A list of random integers, or null if generation fails.

Query.Randoms(int, Random, double, double, double) Method

Generates a list of random doubles within a specified range using a provided Random instance.

public static System.Collections.Generic.List<double>? Randoms(int count, System.Random? random, double start, double end, double tolerance=0.001);

Parameters

count System.Int32

The number of random doubles to generate.

random System.Random

The Random instance to use for generation.

start System.Double

The start value of the range.

end System.Double

The end value of the range.

tolerance System.Double

The tolerance value used during generation.

Returns

System.Collections.Generic.List<System.Double>
A list of random doubles, or null if generation fails.

Query.Randoms(int, Random, int, int) Method

Generates a list of random integers within a specified range using a provided Random instance.

public static System.Collections.Generic.List<int>? Randoms(int count, System.Random? random, int start, int end);

Parameters

count System.Int32

The number of random integers to generate.

random System.Random

The Random instance used to generate the values.

start System.Int32

The inclusive lower bound of the range.

end System.Int32

The exclusive upper bound of the range.

Returns

System.Collections.Generic.List<System.Int32>
A list of random integers, or null if generation fails.

Query.Round(this double, double) Method

Rounds the value to the nearest multiple of the tolerance using decimal precision. This prevents floating-point artifacts common in double arithmetic.

public static double Round(this double value, double tolerance);

Parameters

value System.Double

The value to be rounded.

tolerance System.Double

The tolerance used for rounding.

Returns

System.Double
The rounded value.

Query.Seeds(this int, int) Method

Generates a sequence of seeds.

public static System.Collections.Generic.List<int> Seeds(this int count, int seed=-1);

Parameters

count System.Int32

The number of seeds to generate.

seed System.Int32

The starting seed value.

Returns

System.Collections.Generic.List<System.Int32>
A list of integers representing the seeds.

Query.SerializableMemberInfos(this Type) Method

Retrieves the properties and fields of a type that are marked for serialization.

public static System.Collections.Generic.List<System.Reflection.MemberInfo>? SerializableMemberInfos(this System.Type? type);

Parameters

type System.Type

The type to reflect on.

Returns

System.Collections.Generic.List<System.Reflection.MemberInfo>
A list of serializable MemberInfo objects.

Query.SerializableName(this MemberInfo) Method

Gets the serializable name (e.g. from JsonPropertyNameAttribute) for a MemberInfo.

public static string? SerializableName(this System.Reflection.MemberInfo? memberInfo);

Parameters

memberInfo System.Reflection.MemberInfo

The MemberInfo.

Returns

System.String
The serializable name.

Query.SerializableOrder(this MemberInfo) Method

Gets the serialization order of the specified member, as defined by the System.Text.Json.Serialization.JsonPropertyOrderAttribute.

public static System.Nullable<int> SerializableOrder(this System.Reflection.MemberInfo? memberInfo);

Parameters

memberInfo System.Reflection.MemberInfo

The member to evaluate.

Returns

System.Nullable<System.Int32>
The serialization order if the attribute is present; otherwise, null.

Query.Split<X>(this IEnumerable<X>, int) Method

Splits a sequence into a list of smaller lists, each containing at most maxCount elements.

public static System.Collections.Generic.List<System.Collections.Generic.List<X>>? Split<X>(this System.Collections.Generic.IEnumerable<X>? values, int maxCount);

Type parameters

X

The type of elements in the sequence.

Parameters

values System.Collections.Generic.IEnumerable<X>

The sequence to split.

maxCount System.Int32

The maximum number of elements per chunk.

Returns

System.Collections.Generic.List<System.Collections.Generic.List<X>>
A list of lists, or null if the input is null or maxCount is less than 1.

Query.TimeOffset(this UTC) Method

Converts a UTC enum value to its corresponding numeric hour offset from UTC.

public static double TimeOffset(this DiGi.Core.Enums.UTC uTC);

Parameters

uTC UTC

The UTC timezone enum value.

Returns

System.Double
The numeric hour offset (e.g., 2.0 for UTC+2), or NaN if undefined.

Query.TryConvert(this object, object, DataType) Method

Attempts to convert the specified object using a DataType enum to determine the target type.

public static bool TryConvert(this object? @object, out object? result, DiGi.Core.Enums.DataType dataType);

Parameters

object System.Object

The object to convert.

result System.Object

When this method returns, contains the converted object, or null if conversion failed.

dataType DataType

The DataType enum value indicating the target type.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert(this object, object, Type) Method

Attempts to convert the specified object to the target type.

public static bool TryConvert(this object? @object, out object? result, System.Type? type);

Parameters

object System.Object

The object to convert.

result System.Object

When this method returns, contains the converted object, or null if conversion failed.

type System.Type

The target type to convert to.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert(this JsonElement, object, Type) Method

Attempts to convert a System.Text.Json.JsonElement to the specified target type.

public static bool TryConvert(this System.Text.Json.JsonElement jsonElement, out object? result, System.Type type);

Parameters

jsonElement System.Text.Json.JsonElement

The JsonElement to convert.

result System.Object

When this method returns, contains the converted object, or null if conversion failed.

type System.Type

The target type to convert to.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert<T>(this object, T) Method

Attempts to convert the specified object to the target type T.

public static bool TryConvert<T>(this object? @object, out T? result);

Type parameters

T

The target type to convert to.

Parameters

object System.Object

The object to convert.

result T

When this method returns, contains the converted value, or default if conversion failed.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Boolean(object, Nullable<bool>) Method

Attempts to convert the specified object to a nullable boolean.

public static bool TryConvert_Boolean(object @object, out System.Nullable<bool> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.Boolean>

When this method returns, contains the converted bool, or null if conversion failed.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Byte(object, Nullable<byte>) Method

Attempts to convert the specified object to a nullable byte.

public static bool TryConvert_Byte(object @object, out System.Nullable<byte> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.Byte>

When this method returns, contains the converted byte, or null if conversion failed.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Char(object, Nullable<char>) Method

Attempts to convert the specified object to a nullable char.

public static bool TryConvert_Char(object @object, out System.Nullable<char> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.Char>

When this method returns, contains the converted char value if successful; otherwise, null.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Color(object, Nullable<Color>) Method

Attempts to convert the specified object to a nullable System.Drawing.Color.

public static bool TryConvert_Color(object @object, out System.Nullable<System.Drawing.Color> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.Drawing.Color>

When this method returns, contains the converted Color, or null if conversion failed.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_DateTime(object, Nullable<DateTime>) Method

Attempts to convert the specified object to a nullable System.DateTime.

public static bool TryConvert_DateTime(object @object, out System.Nullable<System.DateTime> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.DateTime>

When this method returns, contains the converted DateTime, or null if conversion failed.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_DateTimeOffset(object, Nullable<DateTimeOffset>) Method

Attempts to convert the specified object to a nullable DateTimeOffset.

public static bool TryConvert_DateTimeOffset(object @object, out System.Nullable<System.DateTimeOffset> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.DateTimeOffset>

When this method returns, contains the converted DateTimeOffset, or null if conversion failed.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Decimal(object, Nullable<decimal>) Method

Attempts to convert the specified object to a nullable decimal.

public static bool TryConvert_Decimal(object @object, out System.Nullable<decimal> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.Decimal>

When this method returns, contains the converted decimal, or null if conversion failed.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Double(object, Nullable<double>) Method

Attempts to convert the specified object to a nullable double.

public static bool TryConvert_Double(object @object, out System.Nullable<double> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.Double>

When this method returns, contains the converted double, or null if conversion failed.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Enum(object, Enum, Type) Method

Attempts to convert the specified object to an Enum of the specified type.

public static bool TryConvert_Enum(object @object, out System.Enum? result, System.Type type);

Parameters

object System.Object

The object to convert.

result System.Enum

When this method returns, contains the converted Enum, or null if conversion failed.

type System.Type

The target enum type.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Enumerable(object, IEnumerable, Type) Method

Attempts to convert the specified object to an IEnumerable of the specified type.

public static bool TryConvert_Enumerable(object @object, out System.Collections.IEnumerable? result, System.Type type);

Parameters

object System.Object

The object to convert.

result System.Collections.IEnumerable

When this method returns, contains the converted IEnumerable, or null if conversion failed.

type System.Type

The target enumerable type.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Float(object, Nullable<float>) Method

Attempts to convert the specified object to a nullable float.

public static bool TryConvert_Float(object @object, out System.Nullable<float> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.Single>

When this method returns, contains the converted float, or null if conversion failed.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Guid(object, Nullable<Guid>) Method

Attempts to convert the specified object to a nullable System.Guid.

public static bool TryConvert_Guid(object @object, out System.Nullable<System.Guid> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.Guid>

When this method returns, contains the converted Guid, or null if conversion failed.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Int(object, Nullable<int>) Method

Attempts to convert the specified object to a nullable int.

public static bool TryConvert_Int(object @object, out System.Nullable<int> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.Int32>

When this method returns, contains the converted int, or null if conversion failed.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_JsonNode(object, JsonNode) Method

Attempts to convert the specified object to a System.Text.Json.Nodes.JsonNode.

public static bool TryConvert_JsonNode(object @object, out System.Text.Json.Nodes.JsonNode? result);

Parameters

object System.Object

The object to convert.

result System.Text.Json.Nodes.JsonNode

When this method returns, contains the converted JsonNode, or null if conversion failed.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Long(object, Nullable<long>) Method

Attempts to convert the specified object to a nullable long.

public static bool TryConvert_Long(object @object, out System.Nullable<long> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.Int64>

When this method returns, contains the converted long, or null if conversion failed.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Sbyte(object, Nullable<sbyte>) Method

Attempts to convert the specified object to a nullable sbyte.

public static bool TryConvert_Sbyte(object @object, out System.Nullable<sbyte> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.SByte>

When this method returns, contains the converted sbyte value if successful; otherwise, null.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_SerializableObject(object, ISerializableObject, Type) Method

Attempts to convert the specified object to an ISerializableObject of the specified type.

public static bool TryConvert_SerializableObject(object @object, out DiGi.Core.Interfaces.ISerializableObject? result, System.Type type);

Parameters

object System.Object

The object to convert.

result ISerializableObject

When this method returns, contains the converted ISerializableObject, or null if conversion failed.

type System.Type

The target ISerializableObject type.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Short(object, Nullable<short>) Method

Attempts to convert the specified object to a nullable short.

public static bool TryConvert_Short(object @object, out System.Nullable<short> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.Int16>

When this method returns, contains the converted short, or null if conversion failed.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_String(this object, string) Method

Attempts to convert the specified object to a nullable string.

public static bool TryConvert_String(this object? @object, out string? result);

Parameters

object System.Object

The object to convert.

result System.String

When this method returns, contains the converted string, or null if conversion failed.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_TimeSpan(object, Nullable<TimeSpan>) Method

Attempts to convert the specified object to a System.TimeSpan.

public static bool TryConvert_TimeSpan(object @object, out System.Nullable<System.TimeSpan> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.TimeSpan>

When this method returns, contains the converted TimeSpan value if successful; otherwise, the default value.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Type(object, Type) Method

Attempts to convert the specified object to a System.Type.

public static bool TryConvert_Type(object @object, out System.Type? result);

Parameters

object System.Object

The object to convert.

result System.Type

When this method returns, contains the converted Type value if successful; otherwise, the default value.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Uint(object, Nullable<uint>) Method

Attempts to convert the specified object to an unsigned integer (uint).

public static bool TryConvert_Uint(object @object, out System.Nullable<uint> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.UInt32>

When this method returns, contains the converted uint value if successful; otherwise, the default value.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Ulong(object, Nullable<ulong>) Method

Attempts to convert the specified object to an unsigned long (ulong).

public static bool TryConvert_Ulong(object @object, out System.Nullable<ulong> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.UInt64>

When this method returns, contains the converted ulong value if successful; otherwise, the default value.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryConvert_Ushort(object, Nullable<ushort>) Method

Attempts to convert the specified object to an unsigned short (ushort).

public static bool TryConvert_Ushort(object @object, out System.Nullable<ushort> result);

Parameters

object System.Object

The object to convert.

result System.Nullable<System.UInt16>

When this method returns, contains the converted ushort value if successful; otherwise, the default value.

Returns

System.Boolean
True if the conversion was successful; otherwise, false.

Query.TryGetEnum(string, Enum) Method

Attempts to parse a "TypeFullName:EnumValueName" formatted string into an Enum value.

public static bool TryGetEnum(string? text, out System.Enum? @enum);

Parameters

text System.String

The text in "TypeFullName:EnumValueName" format.

enum System.Enum

When this method returns, contains the parsed Enum value, or null if parsing failed.

Returns

System.Boolean
True if the parsing was successful; otherwise, false.

Query.TryGetEnum(this string, Type, Enum) Method

Attempts to parse a string into an enum value by checking names, descriptions, and fuzzy matching.

public static bool TryGetEnum(this string? text, System.Type? type, out System.Enum? @enum);

Parameters

text System.String

The string text to be parsed.

type System.Type

The type of the enum to parse into.

enum System.Enum

When this method returns, contains the parsed enum value if successful; otherwise, null.

Returns

System.Boolean
True if the string was successfully parsed into an enum value; otherwise, false.

Query.TryGetEnum<TEnum>(this string, TEnum) Method

Attempts to parse a string into a strongly-typed enum value of type TEnum.

public static bool TryGetEnum<TEnum>(this string? text, out TEnum? @enum)
    where TEnum : System.Enum;

Type parameters

TEnum

The target enum type.

Parameters

text System.String

The text to parse.

enum TEnum

When this method returns, contains the parsed TEnum value, or default if parsing failed.

Returns

System.Boolean
True if the parsing was successful; otherwise, false.

Query.TryGetFirstKey<T>(this IDictionary<string,T>, string, string, Func<string,string>) Method

Attempts to find the first key in the dictionary whose transformed value matches the transformed text.

public static bool TryGetFirstKey<T>(this System.Collections.Generic.IDictionary<string,T>? dictionary, string? text, out string? key, System.Func<string?,string?>? func=null);

Type parameters

T

The type of the dictionary values.

Parameters

dictionary System.Collections.Generic.IDictionary<System.String,T>

The dictionary to search.

text System.String

The text to match against.

key System.String

When this method returns, contains the first matching key, or null if not found.

func System.Func<System.String,System.String>

An optional transformation function applied to both the text and dictionary keys before comparison.

Returns

System.Boolean
True if a matching key was found; otherwise, false.

Query.TryGetKeys<T>(this IDictionary<string,T>, string, List<string>, Func<string,string>) Method

Attempts to find all keys in the dictionary whose transformed value matches the transformed text.

public static bool TryGetKeys<T>(this System.Collections.Generic.IDictionary<string,T>? dictionary, string? text, out System.Collections.Generic.List<string>? keys, System.Func<string?,string?>? func=null);

Type parameters

T

The type of the dictionary values.

Parameters

dictionary System.Collections.Generic.IDictionary<System.String,T>

The dictionary to search.

text System.String

The text to match against.

keys System.Collections.Generic.List<System.String>

When this method returns, contains a list of all matching keys, or null if none were found.

func System.Func<System.String,System.String>

An optional transformation function applied to both the text and dictionary keys before comparison.

Returns

System.Boolean
True if one or more matching keys were found; otherwise, false.

Query.TryGetLowerValue<TKey,TValue>(this SortedDictionary<TKey,TValue>, TKey, TValue, bool, bool) Method

Attempts to get the value associated with the nearest key less than or equal to the specified key in a sorted dictionary.

public static bool TryGetLowerValue<TKey,TValue>(this System.Collections.Generic.SortedDictionary<TKey,TValue>? sortedDictionary, TKey? key, out TValue? value, bool lowerLimit=true, bool upperLimit=false)
    where TKey : System.IComparable<TKey>;

Type parameters

TKey

The type of the keys, which must be comparable.

TValue

The type of the values.

Parameters

sortedDictionary System.Collections.Generic.SortedDictionary<TKey,TValue>

The sorted dictionary to search.

key TKey

The key to look up or find the nearest lower key for.

value TValue

When this method returns, contains the associated value, or default if not found.

lowerLimit System.Boolean

If true, returns false when the key is below the minimum key. If false, clamps to the minimum.

upperLimit System.Boolean

If true, returns false when the key is above the maximum key. If false, clamps to the maximum.

Returns

System.Boolean
True if a value was found; otherwise, false.

Query.TryGetUniqueId(this object, string) Method

Attempts to retrieve the unique identifier of the specified object.

public static bool TryGetUniqueId(this object? @object, out string? uniqueId);

Parameters

object System.Object

The object whose unique ID to retrieve.

uniqueId System.String

When this method returns, contains the unique identifier string, or null if it could not be determined.

Returns

System.Boolean
True if the unique ID was successfully retrieved; otherwise, false.

Query.TryParse(this string, IReference) Method

Attempts to parse the specified string into an IReference.

public static bool TryParse(this string? value, out DiGi.Core.Interfaces.IReference? reference);

Parameters

value System.String

The string to parse.

reference IReference

When this method returns, contains the parsed IReference if successful; otherwise, null.

Returns

System.Boolean
True if the string was successfully parsed; otherwise, false.

Query.TryParse<UReference>(this string, UReference) Method

Attempts to parse the specified string into a UReference.

public static bool TryParse<UReference>(this string? value, out UReference? reference)
    where UReference : DiGi.Core.Interfaces.IReference;

Type parameters

UReference

The type of reference to parse.

Parameters

value System.String

The string to parse.

reference UReference

When this method returns, contains the parsed UReference if successful; otherwise, null.

Returns

System.Boolean
True if the string was successfully parsed; otherwise, false.

Query.TryParseDouble(this string, double) Method

Attempts to parse the specified string into a double-precision floating-point number.

public static bool TryParseDouble(this string value, out double result);

Parameters

value System.String

The string containing the double-precision floating-point number to parse.

result System.Double

When this method returns, contains the parsed value if the conversion was successful; otherwise, zero.

Returns

System.Boolean
true if the string was successfully parsed; otherwise, false.

Query.Type(this TypeReference) Method

Gets the Type associated with the specified TypeReference.

public static System.Type? Type(this DiGi.Core.Classes.TypeReference? typeReference);

Parameters

typeReference TypeReference

The type reference to get the type for.

Returns

System.Type
The Type associated with the specified TypeReference, or null if not found.

Query.Type(this DataType) Method

Gets the Type associated with the specified DataType.

public static System.Type? Type(this DiGi.Core.Enums.DataType dataType);

Parameters

dataType DataType

The data type to get the type for.

Returns

System.Type
The Type associated with the specified DataType, or null if not found.

Query.Type(this string, bool) Method

Gets the Type associated with the specified type name.

public static System.Type? Type(this string? typeName, bool ignoreCase=false);

Parameters

typeName System.String

The name of the type to search for.

ignoreCase System.Boolean

Whether to ignore case during comparison.

Returns

System.Type
The Type associated with the specified type name, or null if not found.

Query.Type(this string, TextComparisonType, bool, Func<Assembly,bool>) Method

Gets the Type associated with the specified type name using custom comparison and assembly filtering.

public static System.Type? Type(this string? typeName, DiGi.Core.Enums.TextComparisonType textComparisonType, bool ignoreCase=false, System.Func<System.Reflection.Assembly,bool>? func=null);

Parameters

typeName System.String

The name of the type to search for.

textComparisonType TextComparisonType

The type of text comparison to use.

ignoreCase System.Boolean

Whether to ignore case during comparison.

func System.Func<System.Reflection.Assembly,System.Boolean>

A function used to filter assemblies.

Returns

System.Type
The Type associated with the specified type name, or null if not found.

Query.UniqueHash(this string, ulong) Method

Computes a unique hash for the specified string.

public static ulong UniqueHash(this string? @string, ulong hash=14695981039346656037uL);

Parameters

string System.String

The string to hash.

hash System.UInt64

The initial hash value (offset basis).

Returns

System.UInt64
The computed unique hash as a ulong.

Query.UniqueHash(this JsonNode, ulong) Method

Computes a unique hash for the specified JsonNode.

public static ulong UniqueHash(this System.Text.Json.Nodes.JsonNode? jsonNode, ulong hash=14695981039346656037uL);

Parameters

jsonNode System.Text.Json.Nodes.JsonNode

The JsonNode to hash.

hash System.UInt64

The initial hash value (offset basis).

Returns

System.UInt64
The computed unique hash as a ulong.

Query.UniqueId(JsonArray) Method

Generates a unique identifier for the specified JsonArray.

public static string UniqueId(System.Text.Json.Nodes.JsonArray? value);

Parameters

value System.Text.Json.Nodes.JsonArray

The JsonArray to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(JsonNode) Method

Generates a unique identifier for the specified JsonNode.

public static string UniqueId(System.Text.Json.Nodes.JsonNode? value);

Parameters

value System.Text.Json.Nodes.JsonNode

The JsonNode to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(JsonValue) Method

Generates a unique identifier for the specified JsonValue.

public static string UniqueId(System.Text.Json.Nodes.JsonValue? value);

Parameters

value System.Text.Json.Nodes.JsonValue

The JsonValue to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this bool) Method

Generates a unique identifier for the specified boolean.

public static string UniqueId(this bool value);

Parameters

value System.Boolean

The boolean value to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this decimal) Method

Generates a unique identifier for the specified decimal.

public static string UniqueId(this decimal value);

Parameters

value System.Decimal

The decimal value to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this ISerializableObject) Method

Generates a unique identifier for the specified ISerializableObject.

public static string UniqueId(this DiGi.Core.Interfaces.ISerializableObject? serializableObject);

Parameters

serializableObject ISerializableObject

The serializable object to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this IUniqueObject) Method

Generates a unique identifier for the specified IUniqueObject.

public static string UniqueId(this DiGi.Core.Interfaces.IUniqueObject? uniqueObject);

Parameters

uniqueObject IUniqueObject

The unique object to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this double) Method

Generates a unique identifier for the specified double.

public static string UniqueId(this double value);

Parameters

value System.Double

The double value to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this float) Method

Generates a unique identifier for the specified float.

public static string UniqueId(this float value);

Parameters

value System.Single

The float value to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this int) Method

Generates a unique identifier for the specified integer.

public static string UniqueId(this int value);

Parameters

value System.Int32

The integer to generate an identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this long) Method

Generates a unique identifier for the specified long.

public static string UniqueId(this long value);

Parameters

value System.Int64

The long value to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this object) Method

Generates a unique identifier for the specified object.

public static string UniqueId(this object? @object);

Parameters

object System.Object

The object to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this short) Method

Generates a unique identifier for the specified short.

public static string UniqueId(this short value);

Parameters

value System.Int16

The short value to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this string) Method

Generates a unique identifier for the specified string.

public static string UniqueId(this string? value);

Parameters

value System.String

The string value to generate a unique identifier for.

Returns

System.String
A unique identifier as a string.

Query.UniqueId(this DateTime) Method

Generates a unique identifier for the specified DateTime.

public static string UniqueId(this System.DateTime value);

Parameters

value System.DateTime

The DateTime value to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this Enum) Method

Generates a unique identifier for the specified nullable Enum.

public static string UniqueId(this System.Enum? @enum);

Parameters

enum System.Enum

The nullable Enum to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this Guid) Method

Generates a unique identifier for the specified Guid.

public static string UniqueId(this System.Guid guid);

Parameters

guid System.Guid

The Guid to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this Nullable<bool>) Method

Generates a unique identifier for the specified nullable boolean.

public static string UniqueId(this System.Nullable<bool> value);

Parameters

value System.Nullable<System.Boolean>

The nullable boolean value to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this Nullable<decimal>) Method

Generates a unique identifier for the specified nullable decimal.

public static string UniqueId(this System.Nullable<decimal> value);

Parameters

value System.Nullable<System.Decimal>

The nullable decimal to generate an identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this Nullable<double>) Method

Generates a unique identifier for the specified nullable double.

public static string UniqueId(this System.Nullable<double> value);

Parameters

value System.Nullable<System.Double>

The nullable double value to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this Nullable<float>) Method

Generates a unique identifier for the specified nullable float.

public static string UniqueId(this System.Nullable<float> value);

Parameters

value System.Nullable<System.Single>

The nullable float value to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this Nullable<int>) Method

Generates a unique identifier for the specified nullable integer.

public static string UniqueId(this System.Nullable<int> value);

Parameters

value System.Nullable<System.Int32>

The nullable integer to generate an identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this Nullable<long>) Method

Generates a unique identifier for the specified nullable long.

public static string UniqueId(this System.Nullable<long> value);

Parameters

value System.Nullable<System.Int64>

The nullable long value to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this Nullable<short>) Method

Generates a unique identifier for the specified nullable short.

public static string UniqueId(this System.Nullable<short> value);

Parameters

value System.Nullable<System.Int16>

The nullable short value to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this Nullable<DateTime>) Method

Generates a unique identifier for the specified nullable DateTime.

public static string UniqueId(this System.Nullable<System.DateTime> value);

Parameters

value System.Nullable<System.DateTime>

The nullable DateTime to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this Nullable<Guid>) Method

Generates a unique identifier for the specified nullable Guid.

public static string UniqueId(this System.Nullable<System.Guid> guid);

Parameters

guid System.Nullable<System.Guid>

The nullable Guid to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this Nullable<uint>) Method

Generates a unique identifier for the specified nullable unsigned integer.

public static string UniqueId(this System.Nullable<uint> value);

Parameters

value System.Nullable<System.UInt32>

The nullable unsigned integer to generate an identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this Nullable<ulong>) Method

Generates a unique identifier for the specified nullable ulong.

public static string UniqueId(this System.Nullable<ulong> value);

Parameters

value System.Nullable<System.UInt64>

The nullable ulong value to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this JsonObject) Method

Generates a unique identifier for the specified JsonObject.

public static string UniqueId(this System.Text.Json.Nodes.JsonObject? value);

Parameters

value System.Text.Json.Nodes.JsonObject

The JsonObject to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this uint) Method

Generates a unique identifier for the specified unsigned integer.

public static string UniqueId(this uint value);

Parameters

value System.UInt32

The unsigned integer to generate an identifier for.

Returns

System.String
A string representing the unique identifier.

Query.UniqueId(this ulong) Method

Generates a unique identifier for the specified ulong.

public static string UniqueId(this ulong value);

Parameters

value System.UInt64

The ulong value to generate a unique identifier for.

Returns

System.String
A string representing the unique identifier.

Query.Value(this JsonNode, Type) Method

Extracts the value from a System.Text.Json.Nodes.JsonNode cast to the specified type.

public static object? Value(this System.Text.Json.Nodes.JsonNode? jsonNode, System.Type? type);

Parameters

jsonNode System.Text.Json.Nodes.JsonNode

The JSON node to extract the value from.

type System.Type

The target type to cast the value to.

Returns

System.Object
The extracted value cast to the specified type, or null if the operation fails or the input is null.

Query.Values(this Range<int>) Method

Generates an array of integers within the specified range.

public static int[]? Values(this DiGi.Core.Classes.Range<int>? range);

Parameters

range DiGi.Core.Classes.Range<System.Int32>

The range from which to generate values.

Returns

System.Int32[]
An array containing all integer values in the range, or null if the range is null.

Settings Class

Provides global settings and managers for the DiGi.Core library.

public static class Settings

Inheritance System.Object → Settings

Properties

Settings.ConversionManager Property

Gets the manager responsible for conversion tasks.

public static DiGi.Core.Classes.ConversionManager ConversionManager { get; }

Property Value

ConversionManager

Settings.SerializationManager Property

Gets the manager responsible for serialization tasks.

public static DiGi.Core.Classes.SerializationManager SerializationManager { get; }

Property Value

SerializationManager

Clone this wiki locally