Skip to content

Instantly share code, notes, and snippets.

@allrameest
Created December 5, 2022 21:04
Show Gist options
  • Save allrameest/2ae978672d5b40113c7a7d2488bdac9e to your computer and use it in GitHub Desktop.
Save allrameest/2ae978672d5b40113c7a7d2488bdac9e to your computer and use it in GitHub Desktop.
var keys = new[] {1, 2, 3};
var map1 = new Dictionary<int, string>();
var map2 = new Dictionary<int, string>();
var items =
from key in keys
let value1 = map1.GetValueOrDefault(key)
where value1 != null
let value2 = map2.GetValueOrDefault(key)
let whatever = 123
select new
{
Value1 = value1.ToUpper(),
Value2 = value2 != null ? value2.ToUpper() : string.Empty
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment