Table of Contents

Class Bindable<T>

Namespace
Bindables
Assembly
Bindables.dll

A container that holds a value and notifies observers when that value changes.

[Serializable]
public class Bindable<T> : IBindWritable<T>, IBindable<T>, IBindable, IBindWritable, IEquatable<T>, IEquatable<Bindable<T>>

Type Parameters

T

The type of the value stored in the bindable.

Inheritance
Bindable<T>
Implements
Derived
Inherited Members
Extension Methods

Constructors

Bindable()

public Bindable()

Bindable(T)

Initializes a new bindable with the specified initial value.

public Bindable(T value)

Parameters

value T

The initial value for the bindable.

Fields

_value

[SerializeField]
protected T _value

Field Value

T

Properties

Value

Gets the current value of the bindable.

public T Value { get; set; }

Property Value

T

Methods

Equals(Bindable<T>)

public bool Equals(Bindable<T> other)

Parameters

other Bindable<T>

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

Equals(T)

public bool Equals(T other)

Parameters

other T

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

NotifyChanged()

Manually triggers change notifications for observers. Use this when the bindable's internal state changes without setting the Value property.

public void NotifyChanged()

SetValueWithoutNotify(T)

Sets the value without triggering change notifications. Useful for initialization or when you want to batch multiple changes.

public void SetValueWithoutNotify(T value)

Parameters

value T

The new value to set.

ToString()

public override string ToString()

Returns

string

Events

OnChange

Event triggered when the bindable value changes.

public event Action OnChange

Event Type

Action

OnChangeWithValue

Event triggered when the bindable value changes, providing the new value.

public event Action<T> OnChangeWithValue

Event Type

Action<T>

Operators

operator ==(Bindable<T>, Bindable<T>)

public static bool operator ==(Bindable<T> left, Bindable<T> right)

Parameters

left Bindable<T>
right Bindable<T>

Returns

bool

implicit operator T(Bindable<T>)

public static implicit operator T(Bindable<T> prop)

Parameters

prop Bindable<T>

Returns

T

operator !=(Bindable<T>, Bindable<T>)

public static bool operator !=(Bindable<T> left, Bindable<T> right)

Parameters

left Bindable<T>
right Bindable<T>

Returns

bool