我在VisualStudio中收到以下錯誤可訪問性不一致:參數類型一般c#界面
可訪問性不一致:參數類型「mynamespace.ProgressChangedEvent」比少的方法訪問「mynamespace.StartScreen.ReceiveUpdate(mynamespace.ProgressChangedEvent )」
我的界面看起來像這樣
public interface IObserver<T>
{
void ReceiveUpdate(T ev);
}
我的活動類看起來像這樣
namespace mynamespace
{
//The event interface
interface Event {}
//Concrete Event
class ProgressChangedEvent : Event
{
private int fileCount = 0;
private int filesProcessed = 0;
public ProgressChangedEvent(int fileCount, int filesProcessed)
{
this.fileCount = fileCount;
this.filesProcessed = filesProcessed;
}
public int FileCount
{
get{return fileCount;}
set{fileCount = value;}
}
public int FilesProcessed
{
get { return filesProcessed; }
set { filesProcessed = value; }
}
}
}
的類是一種形式,它看起來像這樣
namespace mynamespace
{
public partial class StartScreen : Form, IObserver<ProgressChangedEvent>
{
/*
* Lots of form code...
*/
#region IObserver<ProgressChangedEvent> Members
public void ReceiveUpdate(ProgressChangedEvent ev)
{
throw new Exception("The method or operation is not implemented.");
}
#endregion
}
}
方法ReceiveUpdate被加亮並顯示上述錯誤。