0
道歉,但這對我來說是新的,我會很樂意進一步解釋或在必要時編輯這篇文章。包裝類方法參數
我有一個項目類庫,我需要創建一個包裝類庫。該類包含構造函數的自定義類,然後將其用作將從包裝器調用的方法中的參數。
在我的包裝中,我並不想使用引用原始類庫的using語句,所以我想知道處理這些自定義構造函數的最佳方法是什麼?
這裏是我敲什麼DLL我包裝看上去像了一個例子:
public CustomResult WriteMyDataAndReturnResult(CustomerWriterData data)
{
CustomerResult result = // Do stuff
return result;
}
public partial class CustomResult
{
private int resultId;
private MyResponse response;
public int resultIdField
{
get { return this.resultId; }
set { this.resultId = value; }
}
}
public partial class MyResponse
{
private string myMessage;
public string myMessageField
{
get { return this.myMessage; }
set { this.myMessage = value; }
}
}
public partial class CustomerWriterData
{
private string outputPath;
private string inputPath;
public string myOutputPath
{
get { return this.outputPath; }
set { this.outputPath = value; }
}
public string myInputPath
{
get { return this.inputPath; }
set { this.inputPath = value; }
}
}
所以在上面的例子中我的包裝我會希望有一個調用WriteMyDataAndReturnResult的方法,但是這包含一個自定義對象。就此而言,處理事情的最佳方式是什麼?我已經玩弄了在我的包裝中重新創建每個部分類的想法,然後將轉換方法從一個轉換爲另一個,但是這好像我會重寫很多代碼。
有沒有更好的方法讓我避免在調用我的包裝器項目的代碼中包含using語句到原始庫?