mirror of https://github.com/oliverbooth/X10D
Rename param "type" to "member"
This commit is contained in:
parent
4c5f02b221
commit
bc8081d0f9
|
@ -67,22 +67,23 @@ namespace X10D.ReflectionExtensions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TAttribute">The attribute type.</typeparam>
|
/// <typeparam name="TAttribute">The attribute type.</typeparam>
|
||||||
/// <typeparam name="TReturn">The return type of the <paramref name="selector" /> delegate.</typeparam>
|
/// <typeparam name="TReturn">The return type of the <paramref name="selector" /> delegate.</typeparam>
|
||||||
/// <param name="type">The member.</param>
|
/// <param name="member">The member.</param>
|
||||||
/// <param name="selector">A transform function to apply to the attribute.</param>
|
/// <param name="selector">A transform function to apply to the attribute.</param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// An instance of <typeparamref name="TReturn" /> as provided from <paramref name="selector" />.
|
/// An instance of <typeparamref name="TReturn" /> as provided from <paramref name="selector" />.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
/// <exception cref="ArgumentNullException">
|
/// <exception cref="ArgumentNullException">
|
||||||
/// <paramref name="type" /> is <see langword="null" />
|
/// <paramref name="member" /> is <see langword="null" />
|
||||||
/// -or-
|
/// -or-
|
||||||
/// <paramref name="selector" /> is <see langword="null" />.
|
/// <paramref name="selector" /> is <see langword="null" />.
|
||||||
/// </exception>
|
/// </exception>
|
||||||
public static TReturn? SelectFromCustomAttribute<TAttribute, TReturn>(this MemberInfo type, Func<TAttribute, TReturn> selector)
|
public static TReturn? SelectFromCustomAttribute<TAttribute, TReturn>(this MemberInfo member,
|
||||||
|
Func<TAttribute, TReturn> selector)
|
||||||
where TAttribute : Attribute
|
where TAttribute : Attribute
|
||||||
{
|
{
|
||||||
if (type is null)
|
if (member is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(type));
|
throw new ArgumentNullException(nameof(member));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selector is null)
|
if (selector is null)
|
||||||
|
@ -90,7 +91,7 @@ namespace X10D.ReflectionExtensions
|
||||||
throw new ArgumentNullException(nameof(selector));
|
throw new ArgumentNullException(nameof(selector));
|
||||||
}
|
}
|
||||||
|
|
||||||
return type.GetCustomAttribute<TAttribute>() is { } attribute
|
return member.GetCustomAttribute<TAttribute>() is { } attribute
|
||||||
? selector(attribute)
|
? selector(attribute)
|
||||||
: default;
|
: default;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue