using System; public class Test { static Func ConstructRelation(string s) { switch (s) { case ">": return (Func)((a, b) => a > b); case "<": return (Func)((a, b) => a < b); case "==": return (Func)((a, b) => a == b); case ">=": return (Func)((a, b) => a >= b); case "<=": return (Func)((a, b) => a <= b); default: throw new ArgumentException("Unknown relation"); } } public static void Main() { Func rel = ConstructRelation(">"); Console.WriteLine(rel(5, 4)); // выводит True } }