簡體   English   中英

使用列表實現接口並獲取值c#

[英]Implement Interface with List and get Value c#

我有一個名為IConnector的接口

具有以下屬性:

[OperationContract]
List<Details> RequestDetailsSchedule();

[OperationContract]
bool SetDetailsSchedule(List<Details> lstDetails);

我嘗試實施

public class Regulator: IConnector
public List<Details>RequestDetailsSchedule
{
  throw new NotImplementedException();
}

我如何獲得清單的內容?

這是實現接口的最基本方法。

public class Regulator: IConnector
{
    public List<Details> RequestDetailsSchedule()
    {
        throw new NotImplementedException();
    }
    public bool SetDetailsSchedule(List<Details> lstDetails)
    {
        throw new NotImplementedException();
    }
}

清單來自哪里? 數據庫? 無論如何,只是因為您要提出一個抽象,所以我會一直這樣做,就像這樣:

public interface IConnector {
    IEnumerable<Details> RequestDetailsSchedule();
    bool SetDetailsSchedule(IEnumerable<Details> details);
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM