コード例 #1
0
 /// <summary>
 /// Adds a bindable value to the current value and automatically wires up any dependencies.
 /// </summary>
 /// <param name="source">The source value to add.</param>
 /// <param name="toAdd">To item to add.</param>
 /// <returns>
 /// A bindable value representing the sum of the two items.
 /// </returns>
 public static IBindable <long> Add(this IBindable <long> source, IBindable <long> toAdd)
 {
     return(source.Project(s => s + toAdd.Current, DependencyDiscovery.Enabled));
 }
コード例 #2
0
 /// <summary>
 /// Projects a single bindable object into another bindable object, using a lambda to select the new
 /// type of object.
 /// </summary>
 /// <typeparam name="TSource">The type of the source.</typeparam>
 /// <typeparam name="TResult">The type of the result.</typeparam>
 /// <param name="source">The source colection.</param>
 /// <param name="projector">The projector function used to turn the source type into the result type.</param>
 /// <returns>
 /// An object created by the <paramref name="projector"/>. If the source value changes, the item will be projected again.
 /// </returns>
 public static IBindable <TResult> Project <TSource, TResult>(this IBindable <TSource> source, Expression <Func <TSource, TResult> > projector)
 {
     return(source.Project(projector, DefaultDependencyAnalysis));
 }
コード例 #3
0
 /// <summary>
 /// Subtracts a bindable value from the current value and automatically wires up any dependencies.
 /// </summary>
 /// <param name="source">The source value to subtract.</param>
 /// <param name="toSubtract">To item to subtract.</param>
 /// <returns>
 /// A bindable value representing the result of the two items.
 /// </returns>
 public static IBindable <long> Subtract(this IBindable <long> source, IBindable <long> toSubtract)
 {
     return(source.Project(s => s + toSubtract.Current, DependencyDiscovery.Enabled));
 }