Can AutoMapper call a method as intended for each member of a collection at source?

I have two classes as shown below.

public class Destination
{
   public Destination()
   {
      _StringCollection = new List<String>();
   }
   private ICollection<String> _StringCollection;
   public IEnumerable<String> StringCollection
   {
     get
     {
       return _StringCollection.AsEnumerable<String>();
     }
   }

   public void AddString(string str)
   {
      _StringCollection.Add(str);
   }
 }

 public class Source
 {
    public List<String> StringCollection { get; set; }
 }

      

I would like to map this for each member of the original call to AddString (member) in the Destination.

I thought that maybe I can do something with a custom recognizer, but I can't figure out how.

+2


source to share


1 answer


No, you cannot redirect to a specific method. You can open ICollection, but this.



+1


source







All Articles