我想一个人添加到社区和IM不知道如何做?
我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; }
}
在我的服务,我可以添加一个人或像这样一个社会:
List<Community> Communitys = new List<Community>();
List<Person> people = new List<Person>();
public void AddCommunity(Community community)
{
Communitys.Add(community);
}
public void AddPerson(Person person)
{
people.Add(person);
}
public void AddPersonToCommunity(Person person, Community community)
{
//not sure what to do here
}
但我不确定如何加入一个人到社区
public void AddPersonToCommunity(Person person, Community community)
{
//community.CommunityName(Person.Add);?
}
我有一个Windows窗体,当我张贴任何一个人,或者是像这样做了社区:
{
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>");
希望这是一个我想更清晰的两个问题。