Oggetto AutoMapper su ICollection

Oggetto AutoMapper su ICollection

La soluzione per l'oggetto AutoMapper per ICollection
è indicata di seguito:

Ho una classe che è un tipo di valore id definito in una riga. In questo modo:

public class PropertiesModel
{
    public decimal property1 { get; set; }
    public decimal property2 { get; set; }
    ...
    public decimal propertyz { get; set; }
}

e voglio mapparlo su un array di Id Value come segue, creando una semplice raccolta di questa classe:

public class IdValue
{
    public string Id { get; set; }
    public decimal Value { get; set; }
}

il valore risultante dovrebbe essere e oggetto come:

IdValue[] exampleResult = new IdValue[] 
{
    new IdValue {
       Id = property1, // THe name of the first field in Property model
       Value = PropertiesModel.property1 // The actual value of the property 1 on the model
    },
    new IdValue {
       Id = property2, // THe name of the second field in Property model
       Value = PropertiesModel.property2 // The actual value of the property 2 on the model
    },
    ...
    new IdValue {
       Id = propertyz, // THe name of the z-field in Property model
       Value = PropertiesModel.propertyz // The actual value of the property z on the model
    }
}

Ho provato a farlo con AutoMapper come:

CreateMap<PropertiesModel, ICollection<IdValue>>()
    .ForMember(x => x,
        y => y.MapFrom(z => new IdValue
        {
            Id = "Property 1",
            Value = z.property1
         }))
    .ForMember(x => x,
        y => y.MapFrom(z => new IdValue
        {
            Id = "Property 2",
            Value = z.property2
         }))
     ...
    .ForMember(x => x,
        y => y.MapFrom(z => new IdValue
        {
            Id = "Property Z",
            Value = z.propertyz
         }))

Ma questo non funziona, è possibile fare l'automapper in questo modo? Sono sicuro che mi sfugge qualcosa qui. Ho provato a leggere la documentazione, ma non ho trovato un esempio simile a quello che sto cercando di fare.

Un approccio potrebbe essere quello di utilizzare ConvertUsing

CreateMap<PropertiesModel, ICollection<IdValue>>()
    .ConvertUsing(obj => obj.GetType()
                        .GetProperties()
                        .Select(prop => new IdValue
                          {
                              Id = prop.Name,
                              Value = (decimal)prop.GetValue(obj)
                          })
                        .ToArray());