Thursday, July 14, 2016

Convert dictionary to list collection in C#

using linq
accountTypes.Select(kvp => new
            {
                account_type_no = kvp.Key,
                account_type_name = kvp.Value
            }).ToList()
using loop
foreach (var item in accountTypes)
{
    accountTypeList.Add(item.Key);
}

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete