/// <summary> /// Gets the filter text or null. This is <see cref="DsCompletion.FilterText"/> or <see cref="Completion.DisplayText"/> /// if <paramref name="completion"/> is not a <see cref="DsCompletion"/> /// </summary> /// <param name="completion">Completion</param> /// <returns></returns> public static string?TryGetFilterText(this Completion completion) => (completion as DsCompletion)?.FilterText ?? completion.DisplayText;
/// <summary> /// GetHashCode() /// </summary> /// <returns></returns> public override int GetHashCode() => (Completion?.GetHashCode() ?? 0) ^ (IsSelected ? int.MinValue : 0) ^ (IsUnique ? 0x40000000 : 0);
/// <summary> /// Constructor /// </summary> /// <param name="completion">Completion or null</param> /// <param name="isSelected">true if it's selected</param> /// <param name="isUnique">true if it's a unique match</param> public CurrentCompletion(Completion completion, bool isSelected, bool isUnique) { Completion = completion; IsSelected = isSelected; IsUnique = isUnique; }
public MruSelection(Completion completion, int index) { Completion = completion; Index = index; }
/// <summary> /// Gets the MRU index of <paramref name="completion"/> /// </summary> /// <param name="completion">Completion item</param> /// <returns></returns> protected virtual int GetMruIndex(Completion completion) => int.MaxValue;
/// <summary> /// Returns the index of <paramref name="item"/> in the collection or -1 if it's not present /// </summary> /// <param name="item"></param> /// <returns></returns> public int IndexOf(Completion item) => items.IndexOf(item);
/// <summary> /// Checks whether <paramref name="item"/> is present in the collection /// </summary> /// <param name="item">Item</param> /// <returns></returns> public bool Contains(Completion item) => items.Contains(item);
bool ICollection <Completion> .Remove(Completion item) { throw new NotSupportedException(); }
void IList <Completion> .Insert(int index, Completion item) { throw new NotSupportedException(); }
void ICollection <Completion> .Add(Completion item) { throw new NotSupportedException(); }