using System.Collections.Generic;
public class OrderLineDTO
public class DescriptionAttribute : Attribute
private readonly string _description;
public DescriptionAttribute(string description)
_description = description;
public string Description
[Description("Processing")]
[Description("Delivered")]
public static class ExtensionMethods
static public string GetDescription(this OrderStatus This)
var type = typeof(OrderStatus);
var memInfo = type.GetMember(This.ToString());
var attributes = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
return ((DescriptionAttribute)attributes[0]).Description;
public int Id { get; set; }
public List<OrderLine> OrderLines { get; set; }
public OrderStatus Status { get; set; }
public int Id { get; set; }
public List<OrderLineDTO> OrderLines { get; set; }
public string Status { get; set; }
static public void Main()
cfg.CreateMap<Order, OrderDTO>()
src => src.Status.GetDescription()
o.Status = OrderStatus.Sent;
var dto = Mapper.Map<OrderDTO>(o);
Console.WriteLine(dto.Status);