Question: there.

I am trying to program a server.

The server receive some information from client 

and it sends the information to the other server and it receive the response.

Do I need to use select() on this case?

or Pthread only is enough to do this.

my server has many clients connecting concurrently

please answer me kindly.

And if there is, please tell me the source code or site that I can refer to

Answer: 
> 
> I can't code something like myVariable.Where(); since it's not IEnumerable
> 
> 
> 

I don't really understand by what you mean with this.

As for the error, it says you can't cast from the `IEnumerable` to `ExpenseItem`. You have to apply it like you final example like so and return the item rather than `IEnumerable`. I would just skip the `Where` clause and go straight into using `FirstOrDefault`

```
public ExpenseItem ToFind(string trip)
{
    return this.FirstOrDefault(e => e.Trip == trip);
}

```

I presume `this` is a custom made collection otherwise the Linq extensions won't work on `this`

EDIT

If you really want this..

```
public IEnumerable<ExpenseItem> ToFind(string trip)
{
    return this.Where(e => e.Trip == trip);
}

```

Then you will need to deal with the list from the caller.

```
private void tripSelect_SelectedIndexChanged(object sender, EventArgs e)
{
    IEnumerable<ExpenseItem> selectedExpenses = roster.ToFind((string)tripSelect.SelectedItem);
    foreach(ExpenseItem item in selectedExpenses)
        listExpenses.Items.Add(item);
}

```
If you will use this:

```
public IEnumerable<ExpenseItem> ToFind(string trip)
{
    return this.Where(e => e.Trip == trip);
}

```

You need to use this, note the FirstOrDefault:

```
selectedExpense = roster
      .ToFind((string)tripSelect.SelectedItem)
      .FirstOrDefault();

```

Your selectedExpense is not an IEnumerable:

```
private ExpenseItem selectedExpense; 

```

---

By good design, if the finder matches exactly only one record, e.g. by primary key

```
public ExpenseItem ToFind(string expenseId)
{
    return this.FirstOrDefault(e => e.ExpenseId == expenseId);
}

```

,use FirstOrDefault, and then, you can it simply use the finder method like this:

```
selectedExpense = roster.ToFind(idHere);

```