コード例 #1
0
 public static FormLinkNullable <TMajorGetter> Relink <TMajorGetter>(this FormLinkNullable <TMajorGetter> link, IReadOnlyDictionary <FormKey, FormKey> mapping)
     where TMajorGetter : class, IMajorRecordCommonGetter
 {
     if (link.FormKeyNullable.HasValue &&
         !link.IsNull &&
         mapping.TryGetValue(link.FormKey, out var replacement))
     {
         return(new FormLinkNullable <TMajorGetter>(replacement));
     }
     return(link);
 }
コード例 #2
0
 /// <summary>
 /// Compares equality of two links, where rhs is a nullable link.
 /// </summary>
 /// <param name="other">Other link to compare to</param>
 /// <returns>True if FormKey members are equal</returns>
 public bool Equals(FormLinkNullable <TMajorGetter> other) => EqualityComparer <FormKey?> .Default.Equals(this.FormKey, other.FormKeyNullable);