-1

How to convert List to List<T>?

 var memberCommunicationPreferenceses = new PersonifyCollection<MemberCommunicationPreferences>();

memberCommunicationPreferenceses = (from ICustomerOptIn customerOptIn in customerData.CustomerOptIns
        select new Models.MemberCommunicationPreferences()
       {
         MemberCommunicationsPrefernceId = customerOptIn.CustomerOptInId.ToString(CultureInfo.InvariantCulture),
         ShortName = customerOptIn.OptionShortNameString,
         ShortNameDescription = customerOptIn.OptionShortName.Description
         .....
       }).Where(x=>x.OptedInFlag).ToList();

error

Error   23  Cannot implicitly convert type 'System.Collections.Generic.List<EBusiness.Model.Models.MemberCommunicationPreferences>' 
 to 'EBusiness.Model.Models.Collections.PersonifyCollection<.EBusiness.Model.
  Models.MemberCommunicationPreferences>'   C:\\Trunk\Source\EBusiness\EBusiness.Model\Concrete\Personify\
     PersonifyMemberCommunicationPreferences.cs 94  31  EBusiness.Model

update:

--

PersonifyCollection of code based on the 2nd answer in this post enter link description here

Community
  • 1
  • 1
James123
  • 11,184
  • 66
  • 189
  • 343

1 Answers1

0

We don't know what methods your PersonifyCollection class has, so we can't tell you how to convert to it, or if it has any methods to do so. You could try:

var something=new PersonifyCollection<MemberCommunicationPreferences>(memberCommunicationPreferences);

If your custom collection implements the standard constructor that takes an IEnumerable, that should work.

Robert McKee
  • 21,305
  • 1
  • 43
  • 57