gpt4 book ai didi

c# - 错误CS1729 : The type `System.Collections.Generic.List' does not contain a constructor that takes `5' arguments

转载 作者:行者123 更新时间:2023-12-02 10:49:06 27 4
gpt4 key购买 nike

我正在学习C和C#,这个问题是针对C#的。此问题是一本书中的代码,并且代码无法编译,错误是:错误CS1729:类型System.Collections.Generic.List<string>' does not contain a constructor that takes 5'参数。

这是代码:

    public static void Main (string[] args)
{
List<string> names = new List<string>("Christa ",
" Sarah",
"Jonathan",
"Sam",
" Schmekowitz");

最佳答案

()更改为{}


List<string> names = new List<string>{"Christa ",
" Sarah",
"Jonathan",
"Sam",
" Schmekowitz"};

关于c# - 错误CS1729 : The type `System.Collections.Generic.List<string>' does not contain a constructor that takes `5' arguments,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20276322/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com