Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reflection 如何通过反射找到标记有postsharp aspect的类_Reflection_Postsharp - Fatal编程技术网

Reflection 如何通过反射找到标记有postsharp aspect的类

Reflection 如何通过反射找到标记有postsharp aspect的类,reflection,postsharp,Reflection,Postsharp,我尝试了一些使用postsharp的方法 我的一个自定义特性的定义如下所示: <Serializable> _ <MulticastAttributeUsage(PersistMetaData:=True)> _ Public Class StringChecker Inherits LocationInterceptionAspect Public Overrides Sub OnGetValue(ByVal args As LocationInter

我尝试了一些使用postsharp的方法

我的一个自定义特性的定义如下所示:

<Serializable> _
<MulticastAttributeUsage(PersistMetaData:=True)> _
Public Class StringChecker
    Inherits LocationInterceptionAspect

    Public Overrides Sub OnGetValue(ByVal args As LocationInterceptionArgs)
        MyBase.OnGetValue(args)
        ..... ..... .....
当我使用一个普通属性来测试建议时,查询会传递所需的类型。 希望有人能给我一个提示我该做什么

编辑:看起来自定义属性只能在类propertys中找到

问候,,
Markus有两种方法:

  • 使用,但不检索使用IAspectProvider添加的方面
  • 使用

  • 你好,盖尔,谢谢你的快速回复。在您的ReflectionSearch文档中,我发现了一个仅在编译时可用的提示-是这样吗?
    Dim targetClasses As IEnumerable(Of Type) = From asm In AppDomain.CurrentDomain.GetAssemblies().Where(Function(A) A.FullName.Contains("MyNameSpace")) _
                                                    .SelectMany(Function(A) A.GetTypes()) _
                                                    .Where(Function(T) T.IsDefined(GetType(StringChecker), True))