gpt4 book ai didi

c# - ASP.Net C# helper,返回一个数组

转载 作者:太空宇宙 更新时间:2023-11-03 11:06:32 24 4
gpt4 key购买 nike

简单的问题:我需要从辅助函数返回一个数组:

@helper arrayBuilder(){
string pages = System.Configuration.ConfigurationManager.AppSettings["siteNav"];
pages = pages.Replace(" ", string.Empty);
string[] pagesTable = pages.Split(',');

return pagesTable;
}

为什么这不可能?

最佳答案

此方法不应是辅助函数。这应该在您的 Controller 中并在您的模型中返回。辅助函数仅用于显示。一条线索是因为您正在调用 System.Configuration.ConfigurationManager.AppSettings

关于c# - ASP.Net C# helper,返回一个数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15664211/

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