简体   繁体   English

ToList()执行时间太长

[英]ToList() taking too long to execute

I am beginner in asp.net and I am working with a asp.net website in sitefinity. 我是asp.net的初学者,并且正在使用sitefinity中的asp.net网站。 There is a custom widget on a page because of which the page load time drops to 2 mins. 页面上有一个自定义窗口小部件,因此页面加载时间降至2分钟。

After lot of research I found that ToList() could be the reason for this slowness. 经过大量研究,我发现ToList()可能是造成这种速度缓慢的原因。 Below is the C# code of the widget containing the ToList(). 以下是包含ToList()的小部件的C#代码。

namespace SitefinityWebApp.CustomControls
{
    public partial class DashboardRole : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            List<bl.CustomItem> classificationList = bl.module.GetClassifications(bl.config.classification_assets_name, "", bl.config.data_asset_content_type);
            classificationList = classificationList.OrderByDescending(o => o.ItemsCount).ToList();
            rptMainClassifications.DataSource = classificationList;
            rptMainClassifications.DataBind();
        }
    }
}

Is there anyone have faced such issue earlier. 有没有人早些时候遇到过这样的问题。 Any help would mean a lot. 任何帮助都将非常重要。

Edit : This is how GetClassifications() looks like https://i.stack.imgur.com/OsnrW.jpg 编辑:这就是GetClassifications()看起来像https://i.stack.imgur.com/OsnrW.jpg的方式

I'm pretty sure that this is not because of ToList() method. 我很确定这不是因为ToList()方法。
ToList() just convert your IEnumerable() or other list to simple c# List(). ToList()只是将您的IEnumerable()或其他列表转换为简单的c#List()。
There is another problem. 还有另一个问题。 And your question have not enough content to understand the problem. 并且您的问题没有足够的内容来理解问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM