H
hufaunder
I have an interface ITest that includes an event TestStatusChange.
There is also a class Test that implements ITest. In one of the
functions of Test I want to call the event (see code at the end) but
get the following error:
"The event 'eventTest.Test.TestStatusChanged' can only appear on the
left hand side of += or -=.
All samples I saw seem to do the same I am doing. What am I missing?
Thanks
using System;
using System.Collections.Generic;
using System.Text;
namespace eventTest
{
public delegate void TestStatus(String status);
interface ITest
{
event TestStatus TestStatusChanged;
}
class Test : ITest
{
public event TestStatus TestStatusChanged
{
add { TestStatusChanged += value; }
remove { TestStatusChanged -= value; }
}
public void Check()
{
TestStatusChanged("ok"); //!!!!!!!!! COMPILE
ERROR !!!!!!!!!!!!!
}
}
class Program
{
static void Main(string[] args)
{
}
}
}
There is also a class Test that implements ITest. In one of the
functions of Test I want to call the event (see code at the end) but
get the following error:
"The event 'eventTest.Test.TestStatusChanged' can only appear on the
left hand side of += or -=.
All samples I saw seem to do the same I am doing. What am I missing?
Thanks
using System;
using System.Collections.Generic;
using System.Text;
namespace eventTest
{
public delegate void TestStatus(String status);
interface ITest
{
event TestStatus TestStatusChanged;
}
class Test : ITest
{
public event TestStatus TestStatusChanged
{
add { TestStatusChanged += value; }
remove { TestStatusChanged -= value; }
}
public void Check()
{
TestStatusChanged("ok"); //!!!!!!!!! COMPILE
ERROR !!!!!!!!!!!!!
}
}
class Program
{
static void Main(string[] args)
{
}
}
}