// Listing 16-23
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;

[DataContract]
public class Person
{
    private readonly List<Person> _friends = new List<Person>();

    [DataMember]
    public string Name { get; set; }

    [DataMember]
    public IList<Person> Friends { get { return _friends; } }

    public override string ToString()
    {
        return string.Format("{0} (przyjaciele: {1})",
            Name, string.Join(", ", Friends.Select(f => f.Name)));
    }
}
