相关疑难解决方法(0)

c#试图反转列表

public class CategoryNavItem
{
    public int ID { get; set; }
    public string Name { get; set; }
    public string Icon { get; set; }

    public CategoryNavItem(int CatID, string CatName, string CatIcon)
    {
        ID = CatID;
        Name = CatName;
        Icon = CatIcon;
    }
}

public static List<Lite.CategoryNavItem> getMenuNav(int CatID)
{
    List<Lite.CategoryNavItem> NavItems = new List<Lite.CategoryNavItem>();

    -- Snipped code --

    return NavItems.Reverse();
}
Run Code Online (Sandbox Code Playgroud)

反过来不起作用:

Error 3 Cannot implicitly convert type 'void' to 'System.Collections.Generic.List<Lite.CategoryNavItem>'

任何想法为什么会这样?

c# reverse list

85
推荐指数
5
解决办法
8万
查看次数

标签 统计

c# ×1

list ×1

reverse ×1