A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://dotnet.github.io/dotNext/api/DotNext.BasicExtensions.html below:

Class BasicExtensions | .NEXT

Class BasicExtensions

Various extension methods for core data types.

Inheritance

BasicExtensions

Namespace: DotNext Assembly: DotNext.dll Syntax
public static class BasicExtensions
Methods | Edit this page View Source As<T>(T)

Reinterprets object reference.

Declaration
public static T As<T>(this T obj) where T : class?
Parameters Type Name Description T obj

The object reference to reinterpret.

Returns Type Description T

The reinterpreted obj reference.

Type Parameters Name Description T

The target type.

Examples
MemoryManager<T> manager;
manager.As<IDisposable>().Dispose();
| Edit this page View Source Disclosed<T>(T)

Creates disclosed range endpoint.

Declaration
public static DisclosedEndpoint<T> Disclosed<T>(this T value) where T : IComparable<T>
Parameters Type Name Description T value

The endpoint value.

Returns Type Parameters Name Description T

The type of the endpoint.

See Also | Edit this page View Source Enclosed<T>(T)

Creates enclosed range endpoint.

Declaration
public static EnclosedEndpoint<T> Enclosed<T>(this T value) where T : IComparable<T>
Parameters Type Name Description T value

The endpoint value.

Returns Type Parameters Name Description T

The type of the endpoint.

See Also | Edit this page View Source GetUserData<T>(T)

Provides ad-hoc approach to associate some data with the object without modification of it.

Declaration
public static UserDataStorage GetUserData<T>(this T obj) where T : class
Parameters Type Name Description T obj

Target object.

Returns Type Parameters Name Description T

The type of the object.

| Edit this page View Source IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)

Determines whether the specified value is in the specified range.

Declaration
public static bool IsBetween<T, TLowerBound, TUpperBound>(this T value, TLowerBound lowerBound, TUpperBound upperBound) where T : notnull where TLowerBound : IRangeEndpoint<T> where TUpperBound : IRangeEndpoint<T>
Parameters Type Name Description T value

The value to compare.

TLowerBound lowerBound

The lower bound.

TUpperBound upperBound

The upper bound.

Returns Type Description bool

true if value is in the specified range; otherwise, false.

Type Parameters Name Description T

The type of the value.

TLowerBound

The lower bound type.

TUpperBound

The upper bound type.

Examples

The following example demonstrates how to check whether the value is in range [0..1).

double x;
IsBetween(x, 0D.Enclosed(), 1D.Disclosed());
See Also | Edit this page View Source IsNullOrEmpty(Array?)

Indicates that array is null or empty.

Declaration
public static bool IsNullOrEmpty(this Array? array)
Parameters Type Name Description Array array

The array to check.

Returns | Edit this page View Source IsOneOf<T>(T, ReadOnlySpan<T>)

Checks whether the specified object is equal to one of the specified objects.

Declaration
public static bool IsOneOf<T>(this T value, ReadOnlySpan<T> candidates)
Parameters Type Name Description T value

The object to compare with other.

ReadOnlySpan<T> candidates

Candidate objects.

Returns Type Description bool

true, if value is equal to one of candidates.

Type Parameters Name Description T

The type of object to compare.

| Edit this page View Source TryGetValue<T>(T?, out T)

Attempts to get value from nullable container.

Declaration
public static bool TryGetValue<T>(this T? nullable, out T value) where T : struct
Parameters Type Name Description T? nullable

Nullable value.

T value

Underlying value.

Returns Type Parameters Name Description T

The underlying value type of the nullable type.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4