Using a list of tuple and a relative item of a Tuple as an argument of a method

18 Views Asked by At

I have a list of tuples

List<(int pro_order, double pro_price, double pro_values)> 

I'm trying to create a method that will return the highest of any of those properties, such as

public (double maxlist_mininumrt, double minlist_mininumrt) maximum_and_min( List<(int pro_order, double pro_price, double pro_values)>  arg_list0, **<<Property to be sorted??>>**)
{
     (double maxlist_mininumrt, double minlist_mininumrt) rt = new ValueTuple<double, double>();

    foreach (var entry in arg_list0)
    {
        if (entry.**<<Property??>>** > rt.maxlistminimumrt)
        { rt.maxlistminimumrt = entry.**<<Property??>>**  }

        if (entry.**<<Property??>>** < rt.maxlistminimumrt)
        { rt.minlistminimumrt = entry.**<<Property??>>**  }
    }

    return rt;
}

The question is, I'd like that the argument <<Property??>> could be any of the original list of tuples items, either double pro_price, double pro_values. And return an error if the "int" item is selected as an argument.

0

There are 0 best solutions below