title: LINQ to Entities does not recognize the method 'System.String[] Split(Char[])' method, and this method cannot be translated into a store expression
body: <p>I have a function as </p>
  
  <pre><code>private List&lt;AccountViewModel&gt; GetWorkableAccountsForTheMonth()
          {
              var result = GetAllAcountsForLoggedInAgents()
              .Where
                  (
                      a =&gt;
                          ("Deceased,DND,WN,WI,NC,NORESPONSE,SKIP,SHIFTED,SFU".Split(',').Any(x =&gt; x == a.DispCode.GetProperDispCode()))                            
                  ).ToList();
  
          return result;
  
          }
  </code></pre>
  
  <p>The <strong>GetAllAcountsForLoggedInAgents() is of type IQueryable.</strong> and the <strong>GetProperDispCode</strong> is as under</p>
  
  <pre><code>public static string GetProperDispCode(this string dispCode)
          {
              return string.IsNullOrWhiteSpace(dispCode) ? string.Empty : dispCode;
          }
  </code></pre>
  
  <p>While trying to execute this I am encountering the below error</p>
  
  <p><em>LINQ to Entities does not recognize the method 'System.String[] Split(Char[])' method, and this method cannot be translated into a store expression.</em></p>
  
  <p>If I change the type to IEnumerable ( <strong>GetAllAcountsForLoggedInAgents().ToList(</strong>) ), it works... But i don't want to convert to IEnumerable from IQuerable at this point</p>
  
  <p>What change i have to make ?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>So, now I have made the changes as </p>
  
  <pre><code>string[] dispCodeArrays = "Deceased,DND,WN,WI,NC,NORESPONSE,SKIP,SHIFTED,SFU".Split(',');
              var result = GetAllAcountsForLoggedInAgents()
              .Where
                  (
                      a =&gt;
                          (dispCodeArrays.Any(x =&gt; x == a.DispCode.GetProperDispCode()))                       
                  ).ToList();
  </code></pre>
  
  <p>Now the error is </p>
  
  <p><strong>Additional information: LINQ to Entities does not recognize the method 'System.String GetProperDispCode(System.String)' method, and this method cannot be translated into a store expression.</strong></p>
  
  <p>How to overcome this ?</p>