Saturday, 15 March 2014

Migrating Handles (HttpApplication) methods from VB.NET to C#? -



Migrating Handles (HttpApplication) methods from VB.NET to C#? -

this question has reply here:

migrating 'handles' vb.net c# 1 reply

i'm migrating code vb.net c# (4.0).

i find structurs like:

private sub whitepointhttpapplicationbase_beginrequest(sender object, e system.eventargs) handles me.beginrequest end sub

what straight-forward translate such behavior in c#?

in constructor add together this.beginrequest+=whitepointhttpapplicationbase_beginrequest;

you'll need method exist: private void whitepointhttpapplicationbase_beginrequest(sender object, e system.eventargs) { //your event code here }

the next code comment corrections:

namespace whitepoint.solutions.web { public abstract class whitepointhttpapplicationbase : httpapplication { protected whitepointhttpapplicationbase() { this.beginrequest += whitepointhttpapplicationbase_beginrequest; } #region "member" #endregion private void whitepointhttpapplicationbase_beginrequest(object sender, eventargs e) { } } }

the this.beginrequest += not in constructor.

the abstract class how default protected constructor, classes inherit should phone call base of operations constructor if expect code run.

c# vb.net events handles

No comments:

Post a Comment