-1
我有一個asmx webservices的問題。我有那些對象繼承:asmx webservice總是返回子類
public class animal
{
public string id = null;
public string name = null;
}
public class dog: animals
{
public string surname = null;
public string color = null;
}
和web服務
public animal GetAnimal()
{
animal result = new dog();
return result;
}
的問題是,我的web送花兒給人返回狗。有沒有簡單的方法,以便它可以返回動物? (我看見2個解決方案,我不喜歡:
animal result = new animal();
或
animal resultDog = new dog();
animal result = new animal();
result.id = resultDog.id
result.color = resultDog.color
)
您的代碼使用webservice的樣子是什麼樣的? – asawyer 2011-04-29 12:25:16