Creating a class field of type IList<>?
I'm trying to create a POCO obje开发者_Python百科ct called Friend.cs. I can't seem to create inline properties for the 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???
}
Thanks for the help!
You forget the name of the property:
public IList<Friend> Friends {get; set;}
should work.
Your missing the property name
ie
Public IList<Friend> Friends { get; set; }
public class User
{
public IList<Friend> Friends
{
get { return _friends; }
set { _friends = new List<Friend>(value); }
}
private List<Friend> _friends;
}
精彩评论