这是充满了 N 这些都是相同的参考因素?What's the sho" />

T>最短创建一个列表与其中的方式;重复的元素最短、创建一个、元素、方式

由网友(你眼里有星星)分享简介:使用String类,你可以这样做:With the String class, you can do:string text = new string('x', 5);//text is "xxxxx"什么是创建一个列表与其中最短的途径; T>这是充满了 N 这些都是相同的参考因素?What's the sho...

使用String类,你可以这样做:

With the String class, you can do:

string text = new string('x', 5);
//text is "xxxxx"

什么是创建一个列表与其中最短的途径; T>这是充满了 N 这些都是相同的参考因素?

What's the shortest way to create a List< T > that is full of n elements which are all the same reference?

推荐答案

请尝试以下

var l = Enumerable.Repeat('x',5).ToList();
阅读全文

相关推荐

最新文章