0
我有一個接受對象開箱對象
[WebMethod]
public static void GetObject(object data)
{
}
另外一個Web方法,我有2類:
class ConnectionString
{
public string ConnectionString { get; set; }
public DatabaseType DatabaseType { get; set; }
}
class Path
{
public string Path { get; set; }
public bool IsNetwork { get; set; }
}
在客戶機側,使用JavaScript,我定義2類似的類,以及:
function ConnectionString() {
this.ConnectionString = '';
this.DatabaseType = 0;
};
function Path() {
this.Path = '';
this.IsNetwork = false;
};
現在,根據用戶的決定,他可以選擇創建登錄數據庫或文件系統。當我向該方法發送數據時,我的對象爲null。如果我爲每個對象創建方法 ,它就可以工作。有沒有辦法從OBJECT類型解開或desirialize?