Тема: params Expression<Func<T, object>>[] fxns передати заокруглені па.....
Потрібно передати в метод "f" заокругленні параметри до двох символів після крапки.
Не можна змінювати сам метод "f" і список listA, який передається як параметр
using System;
using System.Linq.Expressions;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
public class A
{
    public double b { get; set; }
}
public class HelloWorld
{
    static string GetName2(MemberExpression member)
    {
        var fieldInfo = member.Member as FieldInfo;
        if (fieldInfo != null)
        {
            var d = fieldInfo.GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute;
            if (d != null) return d.Description;
            return fieldInfo.Name;
        }
        var propertInfo = member.Member as PropertyInfo;
        if (propertInfo != null)
        {
            var d = propertInfo.GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute;
            if (d != null) return d.Description;
            return propertInfo.Name;
        }
        return "?-?";
    }
    static string GetName<T>(Expression<Func<T, object>> expr)
    {
        var member = expr.Body as MemberExpression;
        if (member != null)
            return GetName2(member);
        var unary = expr.Body as UnaryExpression;
        if (unary != null)
            return GetName2((MemberExpression)unary.Operand);
        return "?+?";
    }
    public static void f<T>(IEnumerable<T> list, params Expression<Func<T, object>>[] fxns)
    {
        foreach (var fxn in fxns)
        {
            Console.WriteLine("fxn = " + GetName(fxn));
        }
        foreach (var item in list)
        {
            foreach (var fxn in fxns)
            {
                object ob = fxn.Compile()(item);
                Console.WriteLine("fxn2 = " + ob.ToString());
            }
        }
    }
    public static void Main(string[] args)
    {
        A a = new A();
        a.b = 9.123456789;
        List<A> listA = new List<A>();
        listA.Add(a);
        f<A>(
            listA, x => x.b
        );
    }
}Я пробував так:
1)
        f<A>(
            listA,
            x =>
            {
                var c = Math.Round(x.b, 2);
                return (object)c;
            }
        );Помилка (синтаксична): A lambda expression with a statement body cannot be converted to an expression tree
2) Та так
f<A>(listA, x => Math.Round(x.b, 2));Помилка (під час виконання): Unable to cast object of type 'System.Linq.Expressions.MethodCallExpression1' to type 'System.Linq.Expressions.MemberExpression'.'
Як правильно передати метод Math.Round для заокруглення числа "b" ? (Чи таке взагалі можливо ?)