Код: Выделить всё
namespace SampleNamespace
{
public sealed class SampleClass
{
private static readonly Lazy _instance = new Lazy(() => new SampleClass());
public static SampleClass Instance => _instance.Value;
private SampleClass() { }
public event EventHandler SampleEvent;
public void TestCode()
{
Debug.WriteLine("This is for test");
SampleEvent?.Invoke(this, "value");
}
}
}
Код: Выделить всё
error WME1026: Event add method 'SampleNamespace.SampleClass.add_SampleEvent(System.EventHandler)' has return type 'System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken'. Event add methods must return System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken. Was the module that you are exporting compiled as a winmdmodule (/target:winmdobj) for Windows Metadata export?Подробнее здесь: https://stackoverflow.com/questions/797 ... -component
Мобильная версия