Show / Hide Table of Contents

Struct SLazy<T>

Provides support for lazy initialization.

Implements
ILazy<T>
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 Source

SLazy(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.

| Improve this Doc View Source

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 Source

IsCachingExceptions

True if exceptions thrown by the factory delegate are being cached.

Declaration
public bool IsCachingExceptions { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsStructCopySafe

True if the lazy is safe from struct copies.

Declaration
public bool IsStructCopySafe { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsValueCreated

True if Value has been initialized.

Declaration
public bool IsValueCreated { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

ThreadSafety

The pattern of thread safety this lazy is using.

Declaration
public LazyThreadSafetyMode ThreadSafety { get; }
Property Value
Type Description
LazyThreadSafetyMode
| Improve this Doc View Source

Value

Gets the lazily initialized value.

Declaration
public T Value { get; }
Property Value
Type Description
T

Methods

| Improve this Doc View Source

Equals(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 obj are equal or False if not.

| Improve this Doc View Source

GetHashCode()

Gets the hash code of Value.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

The hash code of Value.

| Improve this Doc View Source

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 Source

Equality(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 left and right are equal or False if not.

| Improve this Doc View Source

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>
| Improve this Doc View Source

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>
| Improve this Doc View Source

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 left and right are not equal or False if not.

Implements

ILazy<T>
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX