I have a set of LINQ results as follows:
var dictionaryHere = db.tbl_user_pass_list .Where(e => e.Usage1 == "Domain Administrator"); This returns a number of properties, of which I need the AdminUsername and AdminPassword and Company.
I have a class setup for this:
public class AdminUsernamePassword { public string AdminUsername { get; set; } public string AdminPassword { get; set; } } What I want to generate is a dictionary where the Key is company, and the value contains AdminUsername and AdminPassword. I've got as far as this:
Dictionary<string, AdminUsernamePassword> dictionary = dictionaryHere.ToDictionary(o => o.Company, I'm not sure how to complete this though to get my two other values in as the AdminUsernamePassword type. Any help appreciated!
.ToDictionary(o => o.Company, x => new AdminUserPassword(x.UserName, x.Password)? I assumed a ctor withusernameandpasswordto keep it short.