Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7711455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:22:49+00:00 2026-06-01T01:22:49+00:00

If I have a class, Foo, looking like this… class Foo { public string

  • 0

If I have a class, Foo, looking like this…

class Foo
{
    public string TelephoneNumber1;
    public string TelephoneNumber2;
    public string TelephoneNumber3;
    public string TelephoneNumber4;
}

is it possible to use AutoMapper to map to this class…

class Bar
{
    public ContactInfo[] Contacts;
}

where ContactInfo is…

class ContactInfo
{
    public string TelephoneNumber;
}

if so, how?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T01:22:50+00:00Added an answer on June 1, 2026 at 1:22 am

    Not exactly. You could map a Foo with a string[] of telephone numbers:

    public class Foo
    {
        public string[] TelephoneNumbers { get; set; }
    }
    
    Mapper.CreateMap<Foo, Bar>()
        .ForMember(dest => dest.Contacts, opt => opt.MapFrom(src => src.TelephoneNumbers));
    
    Mapper.CreateMap<string, ContactInfo>()
        .ConvertUsing(value => new ContactInfo { TelephoneNumber = value });
    

    Then you could map like so:

    Bar bar = Mapper.Map<Foo, Bar>(foo);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some text looking like this: My arbitrary content.... ```c# public class Foo
Suppose you have a simple class like this: class foo{ private: int* mData; int
I have: class Foo { int a; int b; std::string s; char d; };
Suppose I have: class Foo { ... }; class Bar : public Foo {
I have a class class foo { public: foo(); foo( int ); private: static
Assume I have a class foo, and wish to use a std::map to store
Consider this abstract class public abstract class Foo { public Injectable Prop {get;set;} }
I was looking over some (C++) code and found something like this: //Foo.cpp namespace
Here is the entirety of a method inside a class: public Foo GetFooByInfoName(string name)
I have an interesting problem. Consider this class hierachy: class Base { public: virtual

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.