小编Nit*_*gav的帖子

如何解决“索引超出数组范围”。同时添加到列表中

我正在尝试将项目添加到列表中,但是我面临以下问题

指数数组的边界之外。

添加项目时出错。我正在使用BOT框架。

我尝试过更改List为,ConcurrentBag但仍不能解决问题。

public static async Task refreshCatagoryLuis(ITurnContext turnContext)
{
    var luisCategoryIntents = await getCatagoryLuisIntentsList("*****-********-******-****");
    ConcurrentBag<string> catagoryList = new ConcurrentBag<string>();
    for (int i = 0; i <= luisCategoryIntents.Length; i++)
    {
        catagoryList.Add(luisCategoryIntents[i].Name);
    }
}
Run Code Online (Sandbox Code Playgroud)

c# .net-core

0
推荐指数
1
解决办法
45
查看次数

标签 统计

.net-core ×1

c# ×1