Lean  $LEAN_TAG$
QuantConnect.Util.Ref< T > Class Template Reference

Represents a reference to any value, T More...

Inheritance diagram for QuantConnect.Util.Ref< T >:
[legend]

Public Member Functions

 Ref (Func< T > getter, Action< T > setter)
 Initializes a new instance of the Ref<T> class More...
 
IReadOnlyRef< T > AsReadOnly ()
 Returns a read-only version of this instance More...
 

Static Public Member Functions

static Ref< T > Create< T > (Func< T > getter, Action< T > setter)
 Creates a new Ref<T> instance More...
 
static IReadOnlyRef< T > CreateReadOnly< T > (Func< T > getter)
 Creates a new IReadOnlyRef<T> instance More...
 
static Ref< T > Create< T > (T initialValue)
 Creates a new Ref<T> instance by closing over the specified initialValue variable. NOTE: This won't close over the variable input to the function, but rather a copy of the variable. This reference will use it's own storage. More...
 

Properties

Value [get, set]
 Gets or sets the value of this reference More...
 
- Properties inherited from QuantConnect.Util.IReadOnlyRef< T >
Value [get]
 Gets the current value this reference points to More...
 

Detailed Description

Represents a reference to any value, T

Provides some helper methods that leverage C# type inference

Template Parameters
TThe data type the reference points to

Definition at line 37 of file Ref.cs.

Constructor & Destructor Documentation

◆ Ref()

QuantConnect.Util.Ref< T >.Ref ( Func< T >  getter,
Action< T >  setter 
)

Initializes a new instance of the Ref<T> class

Parameters
getterA function delegate to get the current value
setterA function delegate to set the current value

Definition at line 47 of file Ref.cs.

Member Function Documentation

◆ AsReadOnly()

IReadOnlyRef<T> QuantConnect.Util.Ref< T >.AsReadOnly ( )

Returns a read-only version of this instance

Returns
A new instance with read-only semantics/gaurantees

Definition at line 66 of file Ref.cs.

◆ Create< T >() [1/2]

static Ref<T> QuantConnect.Util.Ref< T >.Create< T > ( Func< T >  getter,
Action< T >  setter 
)
static

Creates a new Ref<T> instance

Definition at line 83 of file Ref.cs.

◆ CreateReadOnly< T >()

static IReadOnlyRef<T> QuantConnect.Util.Ref< T >.CreateReadOnly< T > ( Func< T >  getter)
static

Creates a new IReadOnlyRef<T> instance

Definition at line 90 of file Ref.cs.

◆ Create< T >() [2/2]

static Ref<T> QuantConnect.Util.Ref< T >.Create< T > ( initialValue)
static

Creates a new Ref<T> instance by closing over the specified initialValue variable. NOTE: This won't close over the variable input to the function, but rather a copy of the variable. This reference will use it's own storage.

Definition at line 104 of file Ref.cs.

Property Documentation

◆ Value

T QuantConnect.Util.Ref< T >.Value
getset

Gets or sets the value of this reference

Definition at line 57 of file Ref.cs.


The documentation for this class was generated from the following file: