---
title: "How to get SecondOrDefault?"  
description: "How to get SecondOrDefault?"  
author: "Anonymous User"  
published: 2014-08-19  
updated: 2014-08-19  
canonical: https://www.mindstick.com/forum/2059/how-to-get-secondordefault  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How to get SecondOrDefault?

I have a [simple](https://yourviews.mindstick.com/story/1469/5-simple-ways-to-stay-fit-amp-healthy) [linq](https://www.mindstick.com/articles/12007/language-integrated-query-linq-queries) [lambda](https://www.mindstick.com/blog/181/lambda-expression-in-c-sharp) statement

```
Interactions = new BindableCollection<InteractionDTO>(ctx.Interactions.Where(x =>
x.ActivityDate > DateTime.Today)   .Select(x => new InteractionDTO   {       Id = x.Id,       ActivityDate = x.ActivityDate,       subject = x.Subject,       ClientNames = x.Attendees.Count == 1 ? x.Attendees.FirstOrDefault().Person.CorrespondenceName
:      
x.Attendees.FirstOrDefault().Person.CorrespondenceName : "Multiple attendees"    }));This will give me the first Client Name, I'm trying to have
it appear First 2 attendees followed by dots. I tried thisClientNames = x.Attendees.Count == 1 ?             
x.Attendees.FirstOrDefault().Person.CorrespondenceName :            
x.Attendees.FirstOrDefault().Person.CorrespondenceName +            
x.Attendees.Skip(1).FirstOrDefault().Person.CorrespondenceName + "
..."
```

But I get this [error](https://yourviews.mindstick.com/view/88527/fixing-quickbooks-error-4120-reinstalling-vs-repairing):

The [method](https://www.mindstick.com/forum/166/webservice-method) '[Skip](https://www.mindstick.com/forum/159872/what-is-the-skip-and-take-combination-in-linq)' is only supported for sorted [input](https://www.mindstick.com/forum/159209/how-can-i-read-convert-an-input-stream-into-a-string-in-java) in LINQ to Entities. The method '[OrderBy](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance)' [must](https://www.mindstick.com/articles/12978/top-reasons-why-every-magento-ecommerce-store-must-opt-for-mobile-app) be called before the method 'Skip'.

## Replies

### Reply by Pravesh Singh

Hi Tanuj, \

I'm not sure what your Attendees class looks like, but assuming it has an ID field:

```
x.Attendees.OrderBy(a => a.ID)           .Skip(1)           .Select(a
=> a.Person.CorrespondenceName).FirstOrDefault() + " ..."
```


---

Original Source: https://www.mindstick.com/forum/2059/how-to-get-secondordefault

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
