gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 19:27:25 30 4
gpt4 key购买 nike

我已将类从 C# 转换为 vb.net .. 我的观点是我想压缩 asp.net 页面以减小页面大小,, 问题是在我转换为 vb.net 后,出现此错误

Description: An error occurred during the compilation of a resourcerequired to service this request. Please review the following specificerror details and modify your source code appropriately.

Compiler Error Message: BC32022: 'Public EventPostRequestHandlerExecute(sender As Object, e As System.EventArgs)' isan event, and cannot be called directly. Use a 'RaiseEvent' statementto 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/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com