我正在尝试将标签添加到组中,因此当我想添加组时,我可以向其添加关联的标签。我试图做的是能够返回按标签过滤的组列表。
List<Group> Groups = new List<Group>();
List<Tag> tags = new List<Tag>();
public void AddTagtoGroup(Group group, Tag tag)
{
group.GroupName(tag.Add);
return Groups with tags or tags with groups
}
这是组和标签的数据协定:
[DataContract(Name = "Group")]
public class Group
{
public Group() // not sure if this has to have a datamember
{
Tags = new List<Tag>();
}
[DataMember(Name = "GroupName")]
public string GroupName { get; set; }
public List<Tag> Tags { get; set; } // datamember or not?
}
[DataContract(Name = "Tag")]
public class Tag
{
[DataMember(Name = "TagName")]
public string TagName { get; set; }
}