Sorry, this is a combination of C # and VB.Net
I have a C # class with two delegates:
public delegate string GetSettingDelegate(string key); public event GetSettingDelegate GetSettingEvent; public delegate void SetSettingDelegate(string key, string value); public event SetSettingDelegate SetSettingEvent;
In the VB class, I add handlers to the event:
AddHandler _gisCtrl.SetSettingEvent, AddressOf SetSetting AddHandler _gisCtrl.GetSettingEvent, AddressOf GetSetting
When I try to remove handlers:
RemoveHandler _gisCtrl.SetSettingEvent, AddressOf SetSetting RemoveHandler _gisCtrl.GetSettingEvent, AddressOf GetSetting
SetSetting is fine, but GetSetting generates a warning:
In this context, the AddressOf expression does not work because the arguments of the AddressOf method require a relaxed conversation with the delagate type of the event.
Here are the methods
Private Sub SetSetting(ByVal key As String, ByVal value As String) KernMobileBusinessLayer.[Global].Settings.SetValue(key, value) End Sub Private Function GetSetting(ByVal key As String) Return KernMobileBusinessLayer.[Global].Settings.GetString(key) End Function
Any idea how to fix this and why is it thrown away in the first place? The 2 delegates / events / methods look quite similar, and I don't know why everything is fine, and one warns.