我的扩展方法都没有显示在Code中

zzn*_*znq 3 .net-3.5

我在当前项目中定义了许多扩展方法.这是一个VB.NET项目.我在App_Code目录中的文件中使用这些方法没有问题,这与我定义方法的地方相同.但是,在我的page.aspx.vb代码页面后面,这些方法没有显示出来.我试过包含正确的命名空间,没有运气.

有没有人知道为什么我不能在代码隐藏文件中调用扩展方法?

在App_Code文件夹中定义

<Extension()> _
Public Function GetSelected(ByVal apps As List(Of Appointment)) As Appointment
    Dim selected = From a In apps _
                   Where a.Selected = True

    Return selected.Single
End Function
Run Code Online (Sandbox Code Playgroud)

在App_Code文件夹中定义,在另一个类中(这个工作正常)

Public ReadOnly Property Selected() As Appointment
    Get
        Return _appointments.GetSelected()
    End Get
End Property
Run Code Online (Sandbox Code Playgroud)

在App Root文件夹中定义,在代码隐藏文件内(不工作)

Public ReadOnly Property Selected() As Appointment
    Get
        Return _appointments.GetSelected()
    End Get
End Property
Run Code Online (Sandbox Code Playgroud)

它们都在同一个应用程序中,没有外部引用.当我构建项目时没有错误,直到我尝试在后面的代码中使用扩展方法.此时错误是'GetSelected'不是'System.Collections.Generic.List(Of Appointment)'的成员

BC.*_*BC. 10

确保您的模块标记为公共.