1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-22 23:58:48 +00:00

Move reflection extensions to Reflection namespace (#7)

This commit is contained in:
Oliver Booth 2022-04-26 10:33:40 +01:00
parent f7b5ef49c8
commit 6d80ee7a6d
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
2 changed files with 6 additions and 8 deletions

View File

@ -1,7 +1,7 @@
using System.Globalization;
using System.Reflection;
namespace X10D;
namespace X10D.Reflection;
/// <summary>
/// Extension methods for <see cref="MemberInfo" />.
@ -76,8 +76,7 @@ public static class MemberInfoExtensions
/// -or-
/// <paramref name="selector" /> is <see langword="null" />.
/// </exception>
public static TReturn? SelectFromCustomAttribute<TAttribute, TReturn>(
this MemberInfo member,
public static TReturn? SelectFromCustomAttribute<TAttribute, TReturn>(this MemberInfo member,
Func<TAttribute, TReturn> selector)
where TAttribute : Attribute
{

View File

@ -1,7 +1,6 @@
using System.Globalization;
using System.Reflection;
namespace X10D;
namespace X10D.Reflection;
/// <summary>
/// Extension methods for <see cref="Type" />.
@ -40,7 +39,7 @@ public static class TypeExtensions
if (!interfaceType.IsInterface)
{
string? exceptionMessage = ExceptionMessages.TypeIsNotInterface;
string? formattedMessage = string.Format(CultureInfo.CurrentCulture, exceptionMessage, interfaceType);
string formattedMessage = string.Format(CultureInfo.CurrentCulture, exceptionMessage, interfaceType);
throw new ArgumentException(formattedMessage, nameof(interfaceType));
}
@ -87,7 +86,7 @@ public static class TypeExtensions
if (!value.IsClass)
{
string? exceptionMessage = ExceptionMessages.TypeIsNotClass;
string? formattedMessage = string.Format(CultureInfo.CurrentCulture, exceptionMessage, value);
string formattedMessage = string.Format(CultureInfo.CurrentCulture, exceptionMessage, value);
throw new ArgumentException(formattedMessage, nameof(value));
}
@ -95,7 +94,7 @@ public static class TypeExtensions
if (!type.IsClass)
{
string? exceptionMessage = ExceptionMessages.TypeIsNotClass;
string? formattedMessage = string.Format(CultureInfo.CurrentCulture, exceptionMessage, type);
string formattedMessage = string.Format(CultureInfo.CurrentCulture, exceptionMessage, type);
throw new ArgumentException(formattedMessage, nameof(type));
}