Linked object for creating chains without lists I need a LinkedList but unfortunatelly the one that the .NET provides didn't have the functionality I was looking for (not working with linq and the LinkedListNode is sealed). I created a replacement that works similar but is linq-compatible.

The main class is a LinkedObject&lt;T&gt; that might be used on it's own but is better suited to be used by composition and should provide all the functionality of a chain:

[DebuggerDisplay("Value = {Value?.ToString()}")]
class LinkedObject&lt;T&gt;
{
    private LinkedObject&lt;T&gt; _previous;
    private LinkedObject&lt;T&gt; _next;

    public LinkedObject() {}

    public LinkedObject(T value)
    {
        Value = value;
    }

    public LinkedObject&lt;T&gt; Previous
    {
        get { return _previous; }
        set
        {
            _previous = value;
            value._next = this;
        }
    }

    public LinkedObject&lt;T&gt; Next
    {
        get { return _next; }
        set
        {
            _next = value;
            value._previous = this;
        }
    }

    public T Value { get; set; }

    // or maybe precessors?
    public IEnumerable&lt;LinkedObject&lt;T&gt;&gt; Before
    {
        get
        {
            var item = this;
            while (item != null)
            {
                yield return item;
                item = item.Previous;
            }
        }
    }

    // or maybe successors?
    public IEnumerable&lt;LinkedObject&lt;T&gt;&gt; After
    {
        get
        {
            var item = this;
            while (item != null)
            {
                yield return item;
                item = item.Next;
            }
        }
    }

    public void Remove()
    {            
        _previous.Next = _next;
        _next.Previous = _previous;
        _previous = null;
        _next = null;
    }
}


Some custom object would use it like this (my real linked-object has a few more additional properties then this simple example):

class Word
{
    private readonly LinkedObject&lt;Sentence&gt; _linkedObject;

    public Word()
    {
        _linkedObject = new LinkedObject&lt;Sentence&gt;(this);
    }

    public string Value 
    { 
        get { return _linkedObject.Value; } 
        set { _linkedObject.Value = value; }
    }        

    public WordPrevious
    {
        get { return _linkedObject.Previous.Value; }
        set { _linkedObject.Previous = value._linkedObject; }
    }

    public Word Next
    {
        get { return _linkedObject.Next.Value; }
        set { _linkedObject.Next = value._linkedObject; }
    }

    public IEnumerable&lt;Word&gt; Before
    {
        get { return _linkedObject.Before.Select(x =&gt; x.Value); }
    }

    public IEnumerable&lt;Word&gt; After
    {
        get { return _linkedObject.After.Select(x =&gt; x.Value); }
    }
}


Example (I use a loop to create the real chain):

var foo = new LinkedObject&lt;string&gt;
{
    Value = "foo",
    Next = new LinkedObject&lt;string&gt;
    {
        Value = "bar",
        Next = new LinkedObject&lt;string&gt;() { Value = "baz" }
    }
};

// foo, bar, baz

foo.Next.Remove(); // foo, baz
Rule your own Find extension method instead of redoing it all over again.

public static LinkedListNode&lt;T&gt; Find&lt;T&gt;(this LinkedList&lt;T&gt; list, Predicate&lt;T&gt; pred)
{
    var node = list.First;
    while (node != null)
    {
        if (pred(node.Value))
        {
            return node;
        }
        node = node.Next;
    }
    return null;
}