using System.Runtime.CompilerServices;
using System.Collections.Generic;
static List<Person> persons = new List<Person>() {
new Person(1, "Person1", "Chennai"),
new Person(2, "Person2", "Mumbai"),
new Person(3, "Person3", "Delhi"),
public static void Main()
FilterPersons(p => p.City == "Bangalore");
static void CheckExpression(bool condition, [CallerArgumentExpression("condition")] string message = null)
Console.WriteLine("continue success");
Console.WriteLine($"Condition failed - {message}");
static List<Person> FilterPersons(Func<Person, bool> condition, [CallerArgumentExpression("condition")] string message = null) {
var result = persons.Where(condition);
if(result.Count() == 0) {
Console.WriteLine($"filter 0 records - {message}");
public record Person(int Id, string FirstName, string City);