我想添加一個人到社區,我不知道它是如何完成的?休息關係?
我datacontract看起來是這樣的:
[DataContract(Name = "Community")]
public class Community
{
public Group()
{
People = new List<Person>();
}
[DataMember(Name = "CommunityName")]
public string CommunityName { get; set; }
public List<Person> People { get; set; }
}
[DataContract(Name = "Person")]
public class Person
{
[DataMember(Name = "PersonName")]
public string PersonName { get; set; }
}
在我的服務,我可以添加一個人或一個社區,像這樣:
但我不確定如何加入一個人到社區
public void AddPersonToCommunity(Person person, Community community)
{
//community.CommunityName(Person.Add);?
}
而且我有一個窗體窗體,當我發佈一個人或一個社區它是這樣完成的:
{
StringBuilder Community = new StringBuilder();
Community.AppendLine("<Community>");
Community.AppendLine("<CommunityName>" + this.textBox4.Text + "</CommunityName>");
Community.AppendLine("</Community>");
但如何將你(一次完成)採取AddPersonToCommunity,使一個字符串生成器,以一個人添加到社區?
{
StringBuilder CommunityAddPerson = new StringBuilder();
CommunityAddPerson.AppendLine("<Community&{1}>");
CommunityAddPerson.AppendLine ......
CommunityAddPerson.AppendLine("<CommunityName>" + this.textBox4.Text + "</CommunityName>");
CommunityAddPerson.AppendLine("</Community>");
希望這個問題更加明確,其中的一個問題我猜得很清楚。
難道你不覺得你需要一個AddPersonToCommunity(社區社區,Person person)方法來完成你所說的話嗎? – 2012-04-06 16:23:29
是的布賴恩,但我在這個方法中放什麼? – 2012-04-06 17:29:01
你的問題和想法都在這個地方。請重新提出您的問題並更加連貫。目前還不清楚你在問什麼。 – 2012-04-06 18:43:13