Querying C# Dictionary using Lambda expressions
<p>Let' say I have this Declared Dictionary:</p>

<pre><code> private static Dictionary&lt;int, List&lt;Models.APIAccessControl&gt;&gt; _APIRights = GetAPIRights();
</code></pre>

<p>Where the key represents the roleId, the value represent the class:</p>

<pre><code> public class APIAccessControl
{
    public APIControllerRoute ControllerRoute { get; set; }
    public APIActionRoute ActionRoute { get; set; }
    public bool IsAuthorized { get; set; }

}
</code></pre>

<p>I am trying to check if the user is authorized to access this api.
My idea is to query the dictionary and get all list of APIAccessControl for the roles, then query those APIAccessControl lists for the APIActionRoute he is trying to navigate:</p>

<p>I got the Dictionary Values that contain those list for the roles i want, but how to cast a List of Values to List and make this query:</p>

<pre><code>public static bool CanAccess(int[] roleIDs, APIActionRoute apiActionRoute)
   {
            bool canAccess = false;

            var apiAccessList = _APIRights.Where(x =&gt; roleIDs.Contains(x.Key)).Select(x =&gt; new { x.Value}).ToList();

      //Querying to get all List&lt;Models.APIAccessControl&gt; that has any matchig   APIActionRoute
    }
</code></pre>