using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); this.Load += Form1_Load; } void Form1_Load(object sender, EventArgs e) { var list = GetSource().ToList(); this.comboBox1.SetDataSource( list, _ => _.Key, _ => _.Value); } Dictionary GetSource() { return AppDomain.CurrentDomain.GetAssemblies() .ToDictionary(x => x.FullName, x => x); } } public static class Ex { public static void SetDataSource( this ComboBox @this, IList dataSource, Expression> displayMember, Expression> valueMember) { // _ => _.Key // ^^^^^ この部分を取得 var displayMemberBody = displayMember.Body as MemberExpression; if (displayMemberBody == null) throw new ArgumentException(); // _ => _.Value // ^^^^^^^ 同様にこの部分を取得 var valueMemberBody = valueMember.Body as MemberExpression; if (valueMemberBody == null) throw new ArgumentException(); @this.DataSource = dataSource; @this.DisplayMember = displayMemberBody.Member.Name; @this.ValueMember = valueMemberBody.Member.Name; } } }