Well, you are actually coming back Dictionary<int, string>. The value type is dictnot an anonymous type; it's plain old string. In fact, it seems that there are no anonymous types or dynamic.
Are you sure this is not what you really want?
public static Dictionary<int, string> GetRuleNamesDictionary()
{
return GetResponseRoutingRules()
.ToDictionary(r => r.ResponseRoutingRuleId, r => r.RuleName);
}
If not, let us know why.
dynamic, , , :
public static Dictionary<int, dynamic> GetRuleNamesDictionary()
{
return GetResponseRoutingRules()
.ToDictionary(r => r.ResponseRoutingRuleId, r => (dynamic) r.RuleName);
}