---
title: "Discussion on \"LINQ gems: Troubles with Out Parameters\" | Hashnode"
description: "Discussion on \"LINQ gems: Troubles with Out Parameters\". How do you deal with out parameters inside of LINQ queries?\nAlmost every time I come across the need to invoke a method inside of a LINQ query, which uses an out argument, I need to stop for a moment and think about what the correct solution is. And ..."
url: "https://hashnode.com/posts/linq-gems-out-parameters/605c235747b0d2243d4ad4b4"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [LINQ gems: Troubles with Out Parameters](https://mydevtricks.com/linq-gems-out-parameters?utm_source=hashnode&utm_medium=feed)

How do you deal with out parameters inside of LINQ queries? Almost every time I come across the need to invoke a method inside of a LINQ query, which uses an out argument, I need to stop for a moment and think about what the correct solution is. And ...

Mar 25, 2021 · 8 min read · mydevtricks.com  
Read the article

-   [#csharp](https://hashnode.com/tag/csharp)
-   [#dotnet](https://hashnode.com/tag/dotnet)
-   [#net](https://hashnode.com/tag/net)

## Written by

[Jan Doubek](https://hashnode.com/@jd-cz)

@jd-cz

  
[View profile](https://hashnode.com/@jd-cz)

Trying to disprove that old-school Devs cannot learn new tricks!

I'm an "old-school" Software Engineer, mostly specializing in C# and .NET. Currently in the process of discovering AI and Machine Learning.

## Responses 1

Markdown supported · ⌘↵ to post

[Francesco Formenti](https://hashnode.com/@formentz)

[Sep 15, 2022](https://hashnode.com/posts/linq-gems-out-parameters/605c235747b0d2243d4ad4b4/comment/63230f438350c8888bf30d82)

Hi Jan, I really appreciate your linq gems! This one pointed me to another solution that, I hope, you and your blog readers could like. It is similar to the value tuple you mentioned:

Using the `new` keyword to create an anonymous type in a `let` clause:

```
var query =
      from word in testWords
      let entry = new
      {
          word,
          usage = wordUsage.TryGetValue(word, out var u) ? u : 0,
      }
      orderby entry.usage
      select (entry.word, entry.usage);
```

Or maybe you can directly do:

```
//[...]
select entry;
```

to use the whole anonymous object as a result.
