Yak*_*kov 2 c# static interface
由于我们无法在接口中定义公共静态方法,这样的接口是否可以在具有public static的类中实现?
public interface IValidator
{
bool IsValid(bool data);
}
public class MyValidator : IValidator
{
public static bool IsValid(string data)
{
//code which returns bool
}
}
Run Code Online (Sandbox Code Playgroud)