我有一個方法在vs2010中的C#應該返回系統的通用對象。因爲這些方法返回不同類型的結果,如int,datatable,string。該對象可以容納INT以及字符串,但是當我緊握或分配數據表的通用對象則拋出誤差 -System.Object類可以保存數據表對象的對象嗎?
Server was unable to process request. ---> There was an error generating the XML document. ---> The type System.Data.DataTable may not be used in this context. To use System.Data.DataTable as a parameter, return type, or member of a class or struct, the parameter, return type, or member must be declared as type System.Data.DataTable (it cannot be object). Objects of type System.Data.DataTable may not be used in un-typed collections, such as ArrayLists.
,因爲我正在開發Web方法所以這就是爲什麼它引發的錯誤的其他部分。
通用對象可以保存數據表對象嗎?
請花一些時間並重新提出問題,以便我們可以更好地理解它。 – naveen