我已将类从 C# 转换为 vb.net .. 我的观点是我想压缩 asp.net 页面以减小页面大小,, 问题是在我转换为 vb.net 后,出现此错误
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC32022: 'Public Event PostRequestHandlerExecute(sender As Object, e As System.EventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.
Source Error:
Line 178:
Line 179: Private Sub Init(context As HttpApplication) Implements IHttpModule.Init
Line 180: context.PostRequestHandlerExecute += New EventHandler(context_BeginRequest)
Line 181: End Sub
Line 182:
我正在尝试为 asp.net 实现 Gzip ... 提前致谢....
最佳答案
AddHandler
当用于事件时,VB.NET 相当于 C# 的 +=
。
AddHandler context.PostRequestHandlerExecute, AddressOf context_BeginRequest
关于events - 将 c# 转换为 vb.net 'RaiseEvent' 语句以引发事件以使用 Gzip,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13410003/