1

我正在尝试创建一个名为 Friend.cs 的 POCO 对象。我似乎无法为 IList 创建内联属性。

public class User
    {
        public string ID { get; set; }
        public string Name { get; set; }
        public string Rating { get; set; }
        public string Photo { get; set; }
        public string Reputation { get; set; }
        public string Group { get; set; }
        public string GroupColor { get; set; }
        public string PostCount { get; set; }
        public string PostPerDay { get; set; }
        public string JoinDate { get; set; }
        public string Views { get; set; }
        public string LastActive { get; set; }
        public string Title { get; set; }
        public string Age { get; set; }
        public string Birthday { get; set; }
        public string Sex { get; set; }
        public string LinkedIn { get; set; }
        public string Facebook { get; set; }
        public string Twitter { get; set; }
        public IList<Friend> {get???
}

谢谢您的帮助!

4

3 回答 3

6

您忘记了属性的名称:

public IList<Friend> Friends {get; set;}

应该管用。

于 2010-07-12T13:03:35.877 回答
3

您缺少属性名称

IE

Public IList<Friend> Friends { get; set; }
于 2010-07-12T13:04:20.473 回答
2
public class User
{
    public IList<Friend> Friends
    {
        get { return _friends; }
        set { _friends = new List<Friend>(value); }
    }

    private List<Friend> _friends;
}
于 2010-07-12T13:05:37.350 回答