如何在 C# 中初始化 1 个以上的变量?
class file_list_output
{
public file_list_output(ListView v, const int max) => veiw = v => max_ext_allowed = max;
}
想不通
你需要这样做:
因此,您的类有两个属性:
public int Max_ext_allowed {get; private set;}
public ListView View {get; private set;}
//To do an expression bodied constructor
//The fat arrow => is replacing the typical { }
//And the next portion (View, Max_ext_allowed) is saying these are the properties being initialized
//Finally the last portion (v, max) is the set of values to set the properties to
public file_list_input(ListView v, int max) => (View, Max_ext_allowed) = (v, max);