خرید بک لینک

Vote count: 0

I am trying to understand if I can use teary operators within a lambda expression.

For example:

public class Foo
{
    public int ID {get; set;}
    public string Name {get; set;}
    public Address MyAdd {get; set;}
}

I then want to do something like this:

        var config = new MapperConfiguration(c =>
        {
            c.CreateMap<foo, MyFoo>()
            .ForMember(x => x.ID, m => m.MapFrom(a => a.ID))
            .ForMember(x => x.Name, m => m.MapFrom(a => a.Name))
            .ForMember(x => x.Add1, m => m.MapFrom(a => (a.MyAdd != null) ? a.MyAdd.Line1 : string.Empty));
        });

However I get the error:

Caot convert lambda expression to type 'string' because it is not a delegate type

asked 29 secs ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 29 تير 1395 ساعت: 1:56

صفحه بندی