Show / Hide Table of Contents

Class ComputedAttribute

Attribute that signals that the property or method it is applied to, should be interpreted as a computed value.

Inheritance
System.Object
ComputedAttribute
Namespace: Cortex.Net.Api
Assembly: Cortex.Net.dll
Syntax
public class ComputedAttribute : Attribute

Constructors

| Improve this Doc View Source

ComputedAttribute(Boolean, Boolean)

Initializes a new instance of the ComputedAttribute class.

Declaration
public ComputedAttribute(bool requiresReaction = false, bool keepAlive = false)
Parameters
Type Name Description
System.Boolean requiresReaction

Whether the computed has to be calculated inside a reactive context.

System.Boolean keepAlive

whether to keep the computed value alive when it's not observed.

| Improve this Doc View Source

ComputedAttribute(String, Boolean, Boolean)

Initializes a new instance of the ComputedAttribute class.

Declaration
public ComputedAttribute(string name, bool requiresReaction = false, bool keepAlive = false)
Parameters
Type Name Description
System.String name

The name of the computed value.

System.Boolean requiresReaction

Whether the computed has to be calculated inside a reactive context.

System.Boolean keepAlive

whether to keep the computed value alive when it's not observed.

| Improve this Doc View Source

ComputedAttribute(String, Type, Boolean, Boolean)

Initializes a new instance of the ComputedAttribute class.

Declaration
public ComputedAttribute(string name, Type equalityComparerType, bool requiresReaction = false, bool keepAlive = false)
Parameters
Type Name Description
System.String name

The name of the computed value.

Type equalityComparerType

The type of the comparer used to see whether the value has changed.

System.Boolean requiresReaction

Whether the computed has to be calculated inside a reactive context.

System.Boolean keepAlive

whether to keep the computed value alive when it's not observed.

| Improve this Doc View Source

ComputedAttribute(Type, Boolean, Boolean)

Initializes a new instance of the ComputedAttribute class.

Declaration
public ComputedAttribute(Type equalityComparerType, bool requiresReaction = false, bool keepAlive = false)
Parameters
Type Name Description
Type equalityComparerType

The type of the comparer used to see whether the value has changed.

System.Boolean requiresReaction

Whether the computed has to be calculated inside a reactive context.

System.Boolean keepAlive

whether to keep the computed value alive when it's not observed.

Properties

| Improve this Doc View Source

EqualityComparerType

Gets the type of the comparer used for equality.

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

KeepAlive

Gets a value indicating whether to keep this computed value alive if it is not observed by anybody. Be aware, this can easily lead to memory leaks as it will result in every observable used by this computed value, keeping the computed value in memory.

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

Name

Gets the Name of the action.

Declaration
public string Name { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

RequiresReaction

Gets a value indicating whether a reactive context is required. it is recommended to set this one to true on very expensive computed values. If you try to read it's value, but the value is not being tracked by some observe, it will cause the computed to throw, instead of doing an expensive re-evalution.

Declaration
public bool RequiresReaction { get; }
Property Value
Type Description
System.Boolean

Extension Methods

TraceExtensions.Trace<TObject, TMember>(TObject, Expression<Func<TObject, TMember>>, TraceMode)
ReactiveObjectTypeUtilExtensions.GetObservable(Object)
ReactiveObjectTypeUtilExtensions.GetObservable<TObject, TMember>(TObject, Expression<Func<TObject, TMember>>)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX