I am having the below source and destination objects:
public class Source
{
public string Value1{ get; set; }
}
public class Destination
{
public string Value1{ get; set; }
public int Ranking { get; set; }
}
I am trying to map the collection object of Source to Collection object of destination. My source collection is like this:
var source = new List<Source>();
source.Add(new Source(){ Value1= "test1" });
source.Add(new Source(){ Value1= "test2" });
How can I write the mapper if the Ranking attribute in the destination object should correspond to the item index in the source collection?
I.e. after mapping the destination ranking for the Source
with Value1 = "test1"
will be 1
and the next one will be 2
.