Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReactiveUI ObservableAsPropertyHelper vs. normal backing variable

I'm struggling with ReactiveUI's learning curve so this question might be naive. Please help me understand the difference between:

ObservableAsPropertyHelper<string> _input
public string Input {get {return _input.Value;}}

and a normal backing variable with RaiseAndSetIfChanged:

private string _input;
public string Input {
    get {return _input;}
    set {RaiseAndSetIfChanged(ref _input, value);}
}

Are they 2 ways to skin the same cat or are there different use cases/intent for the two options?

like image 420
JPtheK9 Avatar asked Dec 09 '18 23:12

JPtheK9


1 Answers

ObserableAsProperyHelper (OAPH) helps you wrap a Obserable into a property. So it will provide INotifyPropertyChanged (INPC) notifications for when a new value is placed into your observable.

The second method provides a standard property with INPC notifications.

like image 146
Glenn Watson Avatar answered Sep 28 '22 23:09

Glenn Watson