Skip to content

Tuple 数组作为参数或返回值时,不生效,但是List 可以 #415

@Vongolar

Description

@Vongolar

数组不行:
(double bps, int workers, int streams)[] Test1((double bps, int workers, int streams)[] table)
{
return new (double bps, int workers, int streams)[] {
(0.3f, 1, 2),
(10f, 1, 8),
(30f, 1, 16),
(70f, 1, 32),
};
}

但是List可以:
List<(double bps, int workers, int streams)> Test1(List<(double bps, int workers, int streams)> table)
{
return new (double bps, int workers, int streams)[] {
(0.3f, 1, 2),
(10f, 1, 8),
(30f, 1, 16),
(70f, 1, 32),
}.ToList();
}

用Tuple<double, int , int)[] 也可以

请问下有知道原因的吗?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions