IScorable<Item,Score> Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Allow the scoring of items, with external comparison of scores, and enable the winner to take some action.
public interface IScorable<in Item,out Score>
type IScorable<'Item, 'Score> = interface
Public Interface IScorable(Of In Item, Out Score)
Type Parameters
- Item
- Score
- Derived
Remarks
We avoided the traditional "bool TryScore(Item item, object state, out Score score)" pattern to allow for Score generic type parameter covariance.
Methods
DoneAsync(Item, Object, CancellationToken) |
The scoring process has completed - dispose of any scoped resources. |
GetScore(Item, Object) |
Gets the score for this item. |
HasScore(Item, Object) |
Returns whether this scorable wants to participate in scoring this item. |
PostAsync(Item, Object, CancellationToken) |
If this scorable wins, this method is called. |
PrepareAsync(Item, CancellationToken) |
Perform some asynchronous work to analyze the item and produce some opaque state. |
Extension Methods
SelectItem<SourceItem,TargetItem,Score>(IScorable<TargetItem,Score>, Func<SourceItem,TargetItem>) |
Project the item of a scorable using a lambda expression. |
SelectScore<Item,SourceScore,TargetScore>(IScorable<Item,SourceScore>, Func<Item,SourceScore,TargetScore>) |
Project the score of a scorable using a lambda expression. |
TryPostAsync<Item,Score>(IScorable<Item,Score>, Item, CancellationToken) |
Invoke the scorable calling protocol against a single scorable. |
WhereScore<Item,Score>(IScorable<Item,Score>, Func<Item,Score,Boolean>) |