Skip to content

Commit

Permalink
Fix bindable default value
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillAshikhmin committed Oct 11, 2018
1 parent 0a44bd4 commit e896ef9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions OrderKingCoreDemo/OrderKingCoreDemo/Helpers/Bindable.cs
Expand Up @@ -43,9 +43,11 @@ public class Bindable : INotifyPropertyChanged, INotifyPropertyChanging {
}

protected T Get<T>(T defValue = default(T), [CallerMemberName] string name = null) {
return !string.IsNullOrEmpty(name) && _properties.TryGetValue(name, out var value)
? (T)value
: defValue;
if (string.IsNullOrEmpty(name)) return defValue;
if (_properties.TryGetValue(name, out var value))
return (T) value;
_properties.AddOrUpdate(name, defValue, (s, o) => defValue);
return defValue;
}

protected bool Set(object value, [CallerMemberName] string name = null) {
Expand Down

0 comments on commit e896ef9

Please sign in to comment.