events - 将 c# 转换为 vb.net 'RaiseEvent' 语句以引发事件以使用 Gzip

标签 events gzip raise raiseevent

我已将类从 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/

相关文章:

Android解压下载的.xml.gz文件

python - raise、try 和 assert 之间有什么区别?

c++ - 如何从句柄中获取事件的名称

node.js - 如何在 koa 中发送 HTTP 响应之前等待 url 回调?

javascript - onpaste/paste 事件在最初的几次尝试中没有为表格触发

javascript - 在返回的 AJAX 内容中调用用户定义的 JS 函数

java - 什么可能导致在 GZip 压缩数据流中创建错误的 EOF

Python tarfile : how to use tar+gzip compression with follow symbolic link?

python-3.x - 不明白assertRaises与生成器+单元测试

Delphi 重新引发异常(作为参数在过程中传递)