Virtualize<TItem>.ItemComparer Property
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.
Gets or sets a comparer used to detect whether items were prepended or appended when using ItemsProvider. The comparer determines if the first loaded item changed between provider calls, which indicates items were inserted above.
Defaults to Default. For records and types implementing
IEquatable<T>, the default works automatically (value equality). For classes
without value-equality semantics, provide a comparer that compares by a unique identifier
(e.g., Id); otherwise reference-equality fallback would produce false-positive
prepend detection when the provider returns fresh instances.
Prepend detection only runs when this parameter is explicitly assigned by the consumer.
The BL0011 analyzer warns when ItemsProvider is used without an
explicit ItemComparer assignment.
For in-memory Items, this parameter is not needed because the component can detect prepends using object identity.
[Microsoft.AspNetCore.Components.Parameter]
public System.Collections.Generic.IEqualityComparer<TItem> ItemComparer { get; set; }
[<Microsoft.AspNetCore.Components.Parameter>]
member this.ItemComparer : System.Collections.Generic.IEqualityComparer<'Item> with get, set
Public Property ItemComparer As IEqualityComparer(Of TItem)
Property Value
- Attributes