Struct SLazy<T>
Provides support for lazy initialization.
Implements
Namespace: Towel
Assembly: Towel.dll
Syntax
public struct SLazy<T> : ILazy<T>
Type Parameters
| Name | Description |
|---|---|
| T | The type of value that is being lazily initialized. |
Constructors
| Improve this Doc View SourceSLazy(T)
Constructs a new SLazy<T> from a T.
Declaration
public SLazy(T value)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value to initialize Value with. |
SLazy(Func<T>)
Constructs a new SLazy<T> from a
Declaration
public SLazy(Func<T> func)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<T> | func | The method used to initialize Value. |
Properties
| Improve this Doc View SourceIsCachingExceptions
True if exceptions thrown by the factory delegate are being cached.
Declaration
public bool IsCachingExceptions { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsStructCopySafe
True if the lazy is safe from struct copies.
Declaration
public bool IsStructCopySafe { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsValueCreated
True if Value has been initialized.
Declaration
public bool IsValueCreated { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ThreadSafety
The pattern of thread safety this lazy is using.
Declaration
public LazyThreadSafetyMode ThreadSafety { get; }
Property Value
| Type | Description |
|---|---|
| LazyThreadSafetyMode |
Value
Gets the lazily initialized value.
Declaration
public T Value { get; }
Property Value
| Type | Description |
|---|---|
| T |
Methods
| Improve this Doc View SourceEquals(Nullable<Object>)
Checks for equality between Value and obj.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Nullable<System.Object> | obj | The value to compare to Value. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if Value and |
GetHashCode()
Gets the hash code of Value.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | The hash code of Value. |
ToString()
Returns a string that represents Value.
Declaration
public override string? ToString()
Returns
| Type | Description |
|---|---|
| System.Nullable<System.String> | A string that represents Value |
Operators
| Improve this Doc View SourceEquality(SLazy<T>, SLazy<T>)
Checks for equality between left and right.
Declaration
public static bool operator ==(SLazy<T> left, SLazy<T> right)
Parameters
| Type | Name | Description |
|---|---|---|
| SLazy<T> | left | The first value of the equality check. |
| SLazy<T> | right | The second value of the equality check. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if |
Implicit(T to SLazy<T>)
Constructs a new SLazy<T> from a T.
Declaration
public static implicit operator SLazy<T>(T value)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value to initialize Value with. |
Returns
| Type | Description |
|---|---|
| SLazy<T> |
Implicit(Func<T> to SLazy<T>)
Constructs a new SLazy<T> from a
Declaration
public static implicit operator SLazy<T>(Func<T> func)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<T> | func | The method used to initialize Value. |
Returns
| Type | Description |
|---|---|
| SLazy<T> |
Inequality(SLazy<T>, SLazy<T>)
Checks for inequality between left and right.
Declaration
public static bool operator !=(SLazy<T> left, SLazy<T> right)
Parameters
| Type | Name | Description |
|---|---|---|
| SLazy<T> | left | The first value of the inequality check. |
| SLazy<T> | right | The second value of the inequality check. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if |