mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-14 04:35:41 +00:00
Move reflection extensions to Reflection namespace (#7)
This commit is contained in:
parent
f7b5ef49c8
commit
6d80ee7a6d
@ -1,7 +1,7 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace X10D;
|
namespace X10D.Reflection;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extension methods for <see cref="MemberInfo" />.
|
/// Extension methods for <see cref="MemberInfo" />.
|
||||||
@ -76,8 +76,7 @@ public static class MemberInfoExtensions
|
|||||||
/// -or-
|
/// -or-
|
||||||
/// <paramref name="selector" /> is <see langword="null" />.
|
/// <paramref name="selector" /> is <see langword="null" />.
|
||||||
/// </exception>
|
/// </exception>
|
||||||
public static TReturn? SelectFromCustomAttribute<TAttribute, TReturn>(
|
public static TReturn? SelectFromCustomAttribute<TAttribute, TReturn>(this MemberInfo member,
|
||||||
this MemberInfo member,
|
|
||||||
Func<TAttribute, TReturn> selector)
|
Func<TAttribute, TReturn> selector)
|
||||||
where TAttribute : Attribute
|
where TAttribute : Attribute
|
||||||
{
|
{
|
@ -1,7 +1,6 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
namespace X10D;
|
namespace X10D.Reflection;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extension methods for <see cref="Type" />.
|
/// Extension methods for <see cref="Type" />.
|
||||||
@ -40,7 +39,7 @@ public static class TypeExtensions
|
|||||||
if (!interfaceType.IsInterface)
|
if (!interfaceType.IsInterface)
|
||||||
{
|
{
|
||||||
string? exceptionMessage = ExceptionMessages.TypeIsNotInterface;
|
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));
|
throw new ArgumentException(formattedMessage, nameof(interfaceType));
|
||||||
}
|
}
|
||||||
@ -87,7 +86,7 @@ public static class TypeExtensions
|
|||||||
if (!value.IsClass)
|
if (!value.IsClass)
|
||||||
{
|
{
|
||||||
string? exceptionMessage = ExceptionMessages.TypeIsNotClass;
|
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));
|
throw new ArgumentException(formattedMessage, nameof(value));
|
||||||
}
|
}
|
||||||
@ -95,7 +94,7 @@ public static class TypeExtensions
|
|||||||
if (!type.IsClass)
|
if (!type.IsClass)
|
||||||
{
|
{
|
||||||
string? exceptionMessage = ExceptionMessages.TypeIsNotClass;
|
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));
|
throw new ArgumentException(formattedMessage, nameof(type));
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user