我有一個第三方的DLL添加到函數的我的網頁application.one看起來像這樣無法理解如何調用該函數
public InterestCategory[] gvc(string st)
{
object[] results = this.Invoke("getit", new object[] {
st});
return ((InterestCategory[])(results[0]));
}
,你可以看到該函數返回InterestCategory[]
。當我檢查(GoToDefinition)InterestCategory我可以看到這個
public partial class InterestCategory
{
private string descriptionField;
public string Description
{
get
{
return this.descriptionField;
}
set
{
this.descriptionField = value;
}
}
}
現在在我的代碼我想這樣調用
API.InterestCategory IC = new API.InterestCategory();
IC = api.gvc(st);
這個功能
它拋出這樣的錯誤
Cannot implicitly convert type 'API.InterestCategory[]' to 'API.InterestCategory'
任何一個可以告訴我什麼是正確的程序來調用這個函數
看看返回類型'InterestCategory []'現在看看你正在設置返回值到'InterestCategory'。現在看看錯誤消息:'不能隱式地將類型'API.InterestCategory []'轉換爲'API.InterestCategory''。現在應該很明顯,你需要將返回值存儲在一個「InterestCategory []」中。 – dtsg
+1因爲這個問題被拒絕了,但是作爲noob的人應該被壓低。 –