IReactiveObjectExtensions.

RaiseAndSetIfChanged<TObj, TRet>(TObj, TRet, TRet, string) Method

Summary

RaiseAndSetIfChanged fully implements a Setter for a read-write property on a ReactiveObject, using CallerMemberName to raise the notification and the ref to the backing field to set the property.
Namespace
ReactiveUI
Containing Type
IReactiveObjectExtensions

Syntax

public static TRet RaiseAndSetIfChanged<TObj, TRet>(this TObj reactiveObject, ref TRet backingField, TRet newValue, string propertyName = null) 
    where TObj : IReactiveObject

Type Parameters

Name Description
TObj The type of the This.
TRet The type of the return value.

Parameters

Name Type Description
reactiveObject TObj The ReactiveObject raising the notification.
backingField TRet A Reference to the backing field for this property.
newValue TRet The new value.
propertyName string The name of the property, usually automatically provided through the CallerMemberName attribute.

Return Value

Type Description
TRet The newly set value, normally discarded.