Can a C# method allow nullable lists as parameters?
<p>I'm trying to write a method that allows for a list of Ids to search for, but I would like to allow the list to be optional. I've seen examples of <code>List&lt;string&gt;</code> but I'm having trouble with <code>List&lt;Guid&gt;</code>. </p>

<p>Trying this method in LinqPad, I get the message:</p>

<blockquote>
  <p>Unable to create a null constant value of type 'System.Collections.Generic.List`1[[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'. Only entity types, enumeration types or primitive types are supported in this context.</p>
</blockquote>

<p>Here's the method:</p>

<pre><code>public static ICollection&lt;Project&gt; GetProjectsAllowed
(
    this IMkpContext db,
    Guid profileId,
    List&lt;Guid&gt; profOrgIds = null
)
{
    var projects = (from p in db.Project.Include(p =&gt; p.Proposals)
                    join po in db.ProfileOrganization on p.CreatedById equals po.ProfileId
                    where (profOrgIds == null || profOrgIds.Contains(po.OrganizationId))
                        &amp;&amp; p.IsActive &amp;&amp; po.IsActive
                    select p);

    return projects.ToList();
}
</code></pre>

<p><strong><em>UPDATE:</em></strong> Thanks to your comments, here's what I did:</p>

<pre><code>public static ICollection&lt;Project&gt; GetProjectsAllowed
(
    this IMkpContext db,
    Guid profileId,
    List&lt;Guid&gt; profOrgIds = null,
    List&lt;Guid&gt; projectIds = null
)
{
    var projects = (from p in db.Project.Include(p =&gt; p.Proposals)
                    where p.IsActive
                    select p);

    if (profOrgIds != null &amp;&amp; profOrgIds.Any())
    {
        var profileIds = db.ProfileOrganization
            .Where(po =&gt; po.IsActive &amp;&amp; profOrgIds.Contains(po.OrganizationId))
            .Select(po =&gt; po.ProfileId);
        projects = projects.Where(p =&gt; profileIds.Contains(p.CreatedById));
    }

    if (projectIds != null &amp;&amp; projectIds.Any())
        projects = projects.Where(proj =&gt; projectIds.Contains(proj.ProjectId));

    return projects.ToList();
}
</code></pre>