The recording of the first ever ReactiveUI virtual conference is available on our YouTube Channel.


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


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.
Containing Type


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.


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.