Skip to content

Commit ac5974d

Browse files
committed
Add AsObservable
1 parent e1c2739 commit ac5974d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/R3/BindableReactiveProperty.cs

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public interface IReadOnlyBindableReactiveProperty<T> : IReadOnlyBindableReactiv
2121
IReadOnlyBindableReactiveProperty<T> EnableValidation(Func<T, Exception?> validator);
2222
IReadOnlyBindableReactiveProperty<T> EnableValidation<TClass>([CallerMemberName] string? propertyName = null!);
2323
IReadOnlyBindableReactiveProperty<T> EnableValidation(Expression<Func<IReadOnlyBindableReactiveProperty<T>?>> selfSelector);
24+
Observable<T> AsObservable();
2425
}
2526

2627
public interface IBindableReactiveProperty : IReadOnlyBindableReactiveProperty
@@ -317,6 +318,11 @@ IReadOnlyBindableReactiveProperty<T> IReadOnlyBindableReactiveProperty<T>.Enable
317318
enableNotifyError = true;
318319
return this;
319320
}
321+
322+
public Observable<T> AsObservable()
323+
{
324+
return this;
325+
}
320326
}
321327

322328
internal sealed class PropertyValidationContext(ValidationContext context, ValidationAttribute[] attributes)

src/R3/ReactivePropertyExtensions.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ public static BindableReactiveProperty<T> ToBindableReactiveProperty<T>(this Obs
3030
return new BindableReactiveProperty<T>(source, initialValue, equalityComparer);
3131
}
3232

33-
public static IBindableReactiveProperty<T> ToReadOnlyBindableReactiveProperty<T>(this Observable<T> source, T initialValue = default!)
33+
public static IReadOnlyBindableReactiveProperty<T> ToReadOnlyBindableReactiveProperty<T>(this Observable<T> source, T initialValue = default!)
3434
{
3535
return new BindableReactiveProperty<T>(source, initialValue, EqualityComparer<T>.Default);
3636
}
3737

38-
public static IBindableReactiveProperty<T> ToReadOnlyBindableReactiveProperty<T>(this Observable<T> source, IEqualityComparer<T>? equalityComparer, T initialValue = default!)
38+
public static IReadOnlyBindableReactiveProperty<T> ToReadOnlyBindableReactiveProperty<T>(this Observable<T> source, IEqualityComparer<T>? equalityComparer, T initialValue = default!)
3939
{
4040
return new BindableReactiveProperty<T>(source, initialValue, equalityComparer);
4141
}
@@ -74,3 +74,4 @@ protected override void OnCompletedCore(Result result)
7474
}
7575
}
7676
}
77+

0 commit comments

Comments
 (0)