C# 类在使用泛型时不实现接口成员
我有一个通用接口,定义如下:C# 类在使用泛型时不实现接口成员,c#,generics,generic-interface,C#,Generics,Generic Interface,我有一个通用接口,定义如下: interface INewRegionBoarding<T> where T: class { bool Create(T objectName); bool ValidateData(T objectName); } } 我真的不确定我做错了什么 谢谢 我真的不确定我做错了什么 您保持类的泛型,但实现具有特定类型的接口。将类定义更改为: public class ESafeActionService: INewRegionBoard
interface INewRegionBoarding<T> where T: class
{
bool Create(T objectName);
bool ValidateData(T objectName);
}
}
我真的不确定我做错了什么
谢谢
我真的不确定我做错了什么
您保持类的泛型,但实现具有特定类型的接口。将类定义更改为:
public class ESafeActionService: INewRegionBoarding<EsafeActons>
{
公共类ESafeActionService:INewRegionBoarding
{
哪种语言?请更新问题以添加该语言的标记
private string corporation;
private string region;
private string portfolioName;
public EsafeActons(string corporation, string region, string portfolioName)
{
this.corporation = corporation;
this.region = region;
this.portfolioName = portfolioName;
}
public string Corporation
{
get { return this.corporation; }
set { this.corporation = value; }
}
public string Region
{
get{return this.corporation;}
set { this.region = value; }
}
public string PortfolioName
{
get { return this.corporation; }
set { this.portfolioName = value; }
}
public bool Create(string corporation, string region, string portfolioName)
{
//call stored proc
return true;
}
public class ESafeActionService: INewRegionBoarding<EsafeActons>
{