<p>For some reason my code won't work.</p>

<pre><code>    from tan in TANS
    where tan.ID.ToString().Count() != 1
    select tan
</code></pre>

<p>I want to select all IDs that are duplicates in a table so I am using the count != 1 and I get this error.</p>

<p>NotSupportedException: Sequence operators not supported for type 'System.String'</p>

<p>Help please?</p>

```
tan.ID.ToString()
```
is a string, not a collection so you can't apply Count().
I believe you want something like:  (This syntax is wrong, but close)
```
```
from tan in TANS
group tan by tan.ID into dups
where dups.Count() > 1
select dups.Key;
```
```
Update (after 5 years minus 5 days): (It's a bit weird to Google a problem and find an answer YOU wrote ..) At the core of this problem is the the LINQ statement is trying to build an SQL statement, and the database doesn't know how to apply Count() to a string.  However, if you use LINQ against a collection in memory, then it would treat the string as an IEnumerable and the Count() would work just fine.