C# Attach properties? to enum

I have an enum:

enum RANK
{
    kingdom=0,
    phylum=1,
    order=2,
    family=3,
    genus=4,
    species=5
}

where each item has a parent (the rank above) and child (the rank below). Out of bounds errors (e.g. trying to find the parent of a kingdom) result in an exception. The questions is whether it is possible to attach an attribute (or anything really) to the enum so that it can be called:

RANK child = kingdom.Child;
RANK parent = species.Parent;

I have code to call this as a function (which is on the border of my understanding)

public static RANK GetParent(this RANK rank)
    {
        if ((rank - 1) > (RANK)0)
        {
            return rank - 1;
        }
        else
        {
            throw new ArgumentOutOfRangeException("No parent rank");
        }
    }

with corresponding GetChild version. Called as:

RANK child = kingdom.GetChild();
RANK parent = species.GetPArent();

This is annoying me, as it's not really a function call but a variable call, and should really be called as such. I'm open to suggestions, however I need enum-type behaviour from the result (fixed list and called in the same way, this is going to be near non-technical people!) So long as it looks like an enum and behaves like an enum, it'll pass as an enum.

Jon Skeet
people
quotationmark

No, there's no such thing as an extension property. But you could create your own class:

public sealed class Rank
{
    private static readonly List<Rank> ranks = new List<Rank>();

    // Important: these must be initialized in order.
    // (That can be avoided, but only at the cost of more code.)        
    public static Rank Kingdom { get; } = new Rank(0);
    public static Rank Phylum { get; } = new Rank(1);
    public static Rank Order { get; } = new Rank(2);
    public static Rank Family { get; } = new Rank(3);
    public static Rank Genus { get; } = new Rank(4);
    public static Rank Species { get; } = new Rank(5);

    private readonly int value;

    // TODO: Change to throw InvalidOperationException (or return null)
    // for boundaries
    public Rank Child => ranks[value + 1];
    public Rank Parent => ranks[value - 1];

    private Rank(int value)
    {
        this.value = value;
        ranks.Add(this);
    }
}

Then you use:

Rank kingdom = Rank.Kingdom;
Rank phylum = kingdom.Child;
// etc

The downside is that you don't get other enum behavior such as switching.

people

See more on this question at Stackoverflow