我想要創建如下的Web服務。我得到的結果列表爲1人,但我只想要普通的東西,因爲它的父母,並有許多孩子,即在它的子級別的細節。創建具有子父概念的Webservice
<person>
<id>1</id>
<name>Manoj</name>
<age>20</age>
<salary>
<month>1</month>
<money>10000</money>
</salary>
<salary>
<month>2</month>
<money>12000</money>
</salary>
<salary>
<month>3</month>
<money>13000</money>
</salary>
</person>
但我的web服務回報
<person>
<id>1</id>
<name>Manoj</name>
<age>20</age>
<month>1</month>
<money>10000</money>
</person>
<person>
<id>1</id>
<name>Manoj</name>
<age>20</age>
<month>2</month>
<money>12000</money>
</person>
<person>
<id>1</id>
<name>Manoj</name>
<age>20</age>
<month>2</month>
<money>13000</money>
</person>
我的信息類
class person
{
int id{get; set;}
string name{get; set;}
int age{get; set;}
int month{get; set;}
int money{get; set;}
}
我怎麼能modyfy類來獲得rusult。
創建一個叫person的類,它有一個構造函數來生成一個人類的集合對象 – Popo
@Sanpopo我很困惑。對象類型的人或工資。 – manoj
我想這取決於你想要的東西,如果你不想爲每個人選擇一個人節點,那麼選擇薪水類,如果你想讓每個人都有一個包含節點的節點(這對我來說是有意義的)那麼可以使用類型人員的集合對象...我假設這是一個家庭作業? – Popo