forked from dotnetcore/AspectCore-Framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMemberReflector.cs
More file actions
25 lines (19 loc) · 929 Bytes
/
Copy pathMemberReflector.cs
File metadata and controls
25 lines (19 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Reflection;
using System.Linq;
namespace AspectCore.Extensions.Reflection
{
public abstract partial class MemberReflector<TMemberInfo> where TMemberInfo : MemberInfo
{
protected TMemberInfo _reflectionInfo;
public virtual string Name => _reflectionInfo.Name;
protected MemberReflector(TMemberInfo reflectionInfo)
{
_reflectionInfo = reflectionInfo ?? throw new ArgumentNullException(nameof(reflectionInfo));
_customAttributeReflectors = _reflectionInfo.CustomAttributes.Select(data => CustomAttributeReflector.Create(data)).ToArray();
}
public override string ToString() => $"{_reflectionInfo.MemberType} : {_reflectionInfo} DeclaringType : {_reflectionInfo.DeclaringType}";
public TMemberInfo GetMemberInfo() => _reflectionInfo;
public virtual string DisplayName => _reflectionInfo.Name;
}
}