---
title: "Result of LINQ.Any to string"  
description: "Result of LINQ.Any to string"  
author: "Anonymous User"  
published: 2013-10-05  
updated: 2013-10-05  
canonical: https://www.mindstick.com/forum/1624/result-of-linq-any-to-string  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Result of LINQ.Any to string

So, I [check if](https://www.mindstick.com/forum/12878/how-to-check-if-an-asp-dot-net-file-upload-control-has-a-file-in-jquery) a [string contains](https://www.mindstick.com/forum/159365/how-to-check-if-a-string-contains-letters-only-in-sql) a certain [word](https://www.mindstick.com/forum/305/read-word-file) from an [array](https://www.mindstick.com/articles/335/jagged-array-in-c-sharp-dot-net) with the following statement:

```
if(stringArray.Any(s => stringToCheck.Contains(s)))
```

\
Simple. Now a [match](https://www.mindstick.com/forum/159713/regex-match-attribute-in-an-html-code) is found and the statement is true. But I want to know also which item in the array [matched](https://answers.mindstick.com/qa/95756/what-are-the-benefits-of-google-adsense-matched-content) with the string. The [placeholder](https://www.mindstick.com/forum/1519/how-do-i-remove-a-listbox-new-item-placeholder) "s" in the [LINQ](https://www.mindstick.com/articles/12007/language-integrated-query-linq-queries) statement above is not available in the following clause.

## Replies

### Reply by Dag Hammarskjold

```
var match = stringArray.FirstOrDefault(s => stringToCheck.Contains(s));if(match != null) {    // match was found}
```

\


---

Original Source: https://www.mindstick.com/forum/1624/result-of-linq-any-to-string

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
