我创建了名单的管制形成这样的:
List<Control> list = new List<Control>();
foreach (Control c in this.Controls)
{
if (c.GetType() == typeof(Label))
{
list.Add(c);
}
}
所有控制,在这个名单是标签,所以我需要这个名单的 控制 中上升了,所以我使用 的排序 方法的列表类似这样的:
list.Sort();
但它对我说 System.InvalidOperationException: 'Failed to compare two elements in the array.' ArgumentException: At least one object must implement IComparable.
因为我想要排序,它使用 TabIndex 值或至少其 名称,目前还不清楚我。 我应该怎么过来 的排序 方法或什么我应该使用,而不是这种方法?