C# 在列表中创建尽可能多的条目

C# 在列表中创建尽可能多的条目,c#,C#,因此,我创建了一个客户帐户名列表 public IEnumerable<String> ClientAccount_Names { get; set; } 然后,我计算了model.UserLoginRecords列表中的entires数 model.UserLoginRecords = _userService.GetFiltered(filter, _preferenceService.GetMaxRows(this.GetType()), null); int numbe

因此,我创建了一个客户帐户名列表

 public IEnumerable<String> ClientAccount_Names { get; set; }
然后,我计算了model.UserLoginRecords列表中的entires数

model.UserLoginRecords = _userService.GetFiltered(filter, _preferenceService.GetMaxRows(this.GetType()), null);
int numberOfUsers = model.UserLoginRecords.Count();
然后,我想将model.userlogin记录中的条目添加到模型中找到的IEnumerable ClientAccount名称中

model.ClientAccount_Names = string.Empty X numberOfUsers;
如何完成最后一部分,即添加尽可能多的条目

:

:

:


使用可枚举范围

model.ClientAccount_Names = Enumerable.Range(0, numberOfUsers)
                                          .Select(r => string.Empty);

使用可枚举范围

model.ClientAccount_Names = Enumerable.Range(0, numberOfUsers)
                                          .Select(r => string.Empty);

使用可枚举范围

model.ClientAccount_Names = Enumerable.Range(0, numberOfUsers)
                                          .Select(r => string.Empty);

使用可枚举范围

model.ClientAccount_Names = Enumerable.Range(0, numberOfUsers)
                                          .Select(r => string.Empty);

你的意思是要添加空字符串

model.ClientAccount_Names = new List<string>();
model.ClientAccount_Names=新列表();
然后

for(int i=0; i < numberOfUsers; i++)
{
    model.ClientAccount_Names.Add("");
}
for(int i=0;i

那就够了

您的意思是要添加空字符串

model.ClientAccount_Names = new List<string>();
model.ClientAccount_Names=新列表();
然后

for(int i=0; i < numberOfUsers; i++)
{
    model.ClientAccount_Names.Add("");
}
for(int i=0;i

那就够了

您的意思是要添加空字符串

model.ClientAccount_Names = new List<string>();
model.ClientAccount_Names=新列表();
然后

for(int i=0; i < numberOfUsers; i++)
{
    model.ClientAccount_Names.Add("");
}
for(int i=0;i

那就够了

您的意思是要添加空字符串

model.ClientAccount_Names = new List<string>();
model.ClientAccount_Names=新列表();
然后

for(int i=0; i < numberOfUsers; i++)
{
    model.ClientAccount_Names.Add("");
}
for(int i=0;i

那就够了

空白条目?有什么意义?@Mansfield,以后只覆盖一部分时的默认值?至少这是我最近遇到类似问题的一个用例。所以我可以在添加条目之后,我知道要添加什么,只需要知道有多少次空白条目?有什么意义?@Mansfield,以后只覆盖一部分时的默认值?至少这是我最近遇到类似问题的一个用例。所以我可以在添加条目之后,我知道要添加什么,只需要知道有多少次空白条目?有什么意义?@Mansfield,以后只覆盖一部分时的默认值?至少这是我最近遇到类似问题的一个用例。所以我可以在添加条目之后,我知道要添加什么,只需要知道有多少次空白条目?有什么意义?@Mansfield,以后只覆盖一部分时的默认值?至少这是我最近遇到的一个类似问题的用例。所以我可以在之后添加条目,我知道要添加什么,只需要知道添加多少次