小编use*_*740的帖子

是否可以对HashTable进行排序?

我有一个返回的属性HashTable.我想在不重构我的财产的情况下对其进行排序.请注意:我不想退回其他类型.码:

    /// <summary>
    /// All content containers.
    /// </summary>
    public Hashtable Containers
    {
        get
        {
            Hashtable tbl = new Hashtable();
            foreach (Control ctrl in Form.Controls)
            {
                if (ctrl is PlaceHolder)
                {
                    tbl.Add(ctrl.ID, ctrl);
                }
                // Also check for user controls with content placeholders.
                else if (ctrl is UserControl)
                {
                    foreach (Control ctrl2 in ctrl.Controls)
                    {
                        if (ctrl2 is PlaceHolder)
                        {
                            tbl.Add(ctrl2.ID, ctrl2);
                        }
                    }
                }
            }

            return tbl;
        }
    }
Run Code Online (Sandbox Code Playgroud)

c# sorting hashtable

14
推荐指数
3
解决办法
3万
查看次数

标签 统计

c# ×1

hashtable ×1

sorting ×1