将方法作为可选参数传递给另一个函数

时间:2015-07-02 19:59:33

标签: vb.net

我有一个函数,它应该将另一个函数作为可选参数并且有一些问题,你能帮忙吗?

add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );

function woo_remove_product_tabs( $tabs ) {
unset( $tabs['additional_information'] );   
return $tabs;
}

问题在于这一行我应该如何构建?:

Function Index(Optional mydel As Func(List Of ProgramLog) = FromOneDayAgo()) As ActionResult
         Dim passedfunction as List(Of ProgramLog)
passedfunction = mydel 
Return View(FromOneDayAgo)
    End Function

  Function FromOneDayAgo() As List(Of ProgramLog)
        Dim programlog As New List(Of ProgramLog)
        ...
        Return programlog
    End Function


Function FromTwoDaysAgo() As List(Of ProgramLog)
        Dim programlog As New List(Of ProgramLog)
        ...
        Return programlog
    End Function

更新 - 我的进一步尝试:

Function Index(Optional mydel As Func(List Of ProgramLog) = FromOneDayAgo()) As ActionResult

0 个答案:

没有答案