Advertisement
elena1234

Simple way to work with lambda expression With is var (Var pattern)

Apr 12th, 2021 (edited)
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.44 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace MathOperations
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Func<int, double> getValue = x => Math.Log(x % 10 - 2); // we don't need this one
  11.  
  12.             var numbers = Enumerable.Range(0, 100).Where(x => Math.Log(x % 10 - 2) is var value && value >= 1 && value <= 2);
  13.             Console.WriteLine(string.Join(" ", numbers));
  14.         }
  15.     }
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement