Skip to content

Commit 348a4d1

Browse files
committed
Reintroduced DefaultType property as [Obsolete]
The `DefaultType` property was removed, in favor of the new `Lookup(params string[])` overload, which allows fallbacks to be defined as subsequent parameters. By reintroducing the original `DefaultType` property, and its associated constructor, we provide instructions to callers of the members.
1 parent e9de72f commit 348a4d1

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

OnTopic/Lookup/StaticTypeLookupService.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,33 @@ public StaticTypeLookupService(
5353

5454
}
5555

56+
/// <summary>
57+
/// Establishes a new instance of a <see cref="StaticTypeLookupService"/>. Optionally accepts a list of <see cref="Type"/>
58+
/// instances and a default <see cref="Type"/> value.
59+
/// </summary>
60+
/// <remarks>
61+
/// Any <see cref="Type"/> instances submitted via <paramref name="types"/> should be unique by <see
62+
/// cref="MemberInfo.Name"/>; if they are not, they will be removed.
63+
/// </remarks>
64+
/// <param name="types">The list of <see cref="Type"/> instances to expose as part of this service.</param>
65+
/// <param name="defaultType">The default type to return if no match can be found. Defaults to object.</param>
66+
[Obsolete("The DefaultType property has been removed. Fallbacks types can now be added to Lookup() directly.", true)]
67+
public StaticTypeLookupService(
68+
IEnumerable<Type>? types,
69+
Type? defaultType
70+
) {
71+
throw new NotImplementedException();
72+
}
73+
74+
/*==========================================================================================================================
75+
| PROPERTY: DEFAULT TYPE
76+
\-------------------------------------------------------------------------------------------------------------------------*/
77+
/// <summary>
78+
/// The default type to return in case <see cref="Lookup(String[])"/> cannot find a match.
79+
/// </summary>
80+
[Obsolete("The DefaultType property has been removed. Fallbacks types can now be added to Lookup() directly.", true)]
81+
public Type? DefaultType { get; }
82+
5683
/*==========================================================================================================================
5784
| METHOD: LOOKUP
5885
\-------------------------------------------------------------------------------------------------------------------------*/

0 commit comments

Comments
 (0)