接口实现问题

发布于 2024-12-09 13:33:51 字数 462 浏览 0 评论 0原文

我有一个像这样的基本接口

public interface IHRMISBaseConnector
    {
         IHRMISEmployeeConnector EmployeeConnector { get  ; set; }  
    }

我还有一个这样的接口

public  interface IHRMISEmployeeConnector
    {
        String Add(EmployeeDetails e);
        Boolean Update(EmployeeDetails e);
        Boolean Delete(int id);
    }

我想在此类 DDWEDocumentOperations 中实现 IHRMISBaseConnector

我如何实现?如果有人知道请告诉我

I Have a Base Interface Like this

public interface IHRMISBaseConnector
    {
         IHRMISEmployeeConnector EmployeeConnector { get  ; set; }  
    }

And i have one more interface like this

public  interface IHRMISEmployeeConnector
    {
        String Add(EmployeeDetails e);
        Boolean Update(EmployeeDetails e);
        Boolean Delete(int id);
    }

I want implement IHRMISBaseConnector in this class DDWEDocumentOperations

How can i implement ? Please let me know if anybody knows it

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陌路黄昏 2024-12-16 13:33:51

像这样的东西应该对你有帮助:

class FakeImplementationOfEmployeeConnector : IHRMISEmployeeConnector
{
    public string Add(EmployeeDetails e)
    {
        //...
    }

    public bool Update(EmployeeDetails e)
    {
        //...
    }

    public bool Delete(int id)
    {
        //...
    }
}

class DDWEDocumentOperations : IHRMISBaseConnector
{
    IHRMISEmployeeConnector employeeConnector = new FakeImplementationOfEmployeeConnector();

    public IHRMISEmployeeConnector EmployeeConnector
    {
        get
        {
            return employeeConnector;
        }
        set
        {
            employeeConnector = value;
        }
    }
}

Something like this should help you:

class FakeImplementationOfEmployeeConnector : IHRMISEmployeeConnector
{
    public string Add(EmployeeDetails e)
    {
        //...
    }

    public bool Update(EmployeeDetails e)
    {
        //...
    }

    public bool Delete(int id)
    {
        //...
    }
}

class DDWEDocumentOperations : IHRMISBaseConnector
{
    IHRMISEmployeeConnector employeeConnector = new FakeImplementationOfEmployeeConnector();

    public IHRMISEmployeeConnector EmployeeConnector
    {
        get
        {
            return employeeConnector;
        }
        set
        {
            employeeConnector = value;
        }
    }
}
小糖芽 2024-12-16 13:33:51

这是一个例子:

    public class DDWEDocumentOperations : IHRMISBaseConnector
    {
        private IHRMISEmployeeConnector _employeeConnector;

        public IHRMISEmployeeConnector EmployeeConnector
        {
            get { return _employeeConnector; }
            set { _employeeConnector = value; }
        }
    }

Here is an example:

    public class DDWEDocumentOperations : IHRMISBaseConnector
    {
        private IHRMISEmployeeConnector _employeeConnector;

        public IHRMISEmployeeConnector EmployeeConnector
        {
            get { return _employeeConnector; }
            set { _employeeConnector = value; }
        }
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文