Use case of nesting an enum into a struct At our office there is this piece of code (the original author isn't employed anymore, so I can't ask him).
Does anybody have an idea, what he did there? Is there any advantage of using this struct OrderDirection instead directly the enum Direction?
(for me, this is interesting and I just wanted to know why.)
public struct OrderDirection 
{
    private enum Direction
    {
        Ascending = 0,
        Descending = 1
    }
    
    private OrderDirection(Direction direction)
    {
        _direction = direction;
    }
    
    private readonly Direction _direction;
    
    public override string ToString()
    {
        switch(_direction)
        {
            case Direction.Ascending: return &quot;asc&quot;;
            case Direction.Descending: return &quot;desc&quot;;
            default: throw new NotImplementedException(nameof(_direction));
        }
    }
    
    public static OrderDirection Ascending = new OrderDirection(Direction.Ascending);
    public static OrderDirection Descending = new OrderDirection(Direction.Descending);
}
In my opinion nothing indicate the use of enum.
According to my understanding your object provides the following functionalities from consumer perspective:

Provide two factory methods one for Ascending and another for Descending
Provide custom string representation (abbreviation) for these

From the public interface point of view the following implementation is equivalent with yours
public struct OrderDirection 
{
    private readonly string _direction;
    private OrderDirection(string direction)
    {
        _direction = direction;
    }
      
    public override string ToString() =&gt; _direction;
    
    public static OrderDirection Ascending = new OrderDirection(&quot;asc&quot;);
    public static OrderDirection Descending = new OrderDirection(&quot;desc&quot;);
}