//定义一个IComparer,去指定比较哪个元素
public class myEmployeeCompare : System.Collections.IComparer
{
public int Compare(object x, object y)
{
return ((VideoSize)x).width - ((VideoSize)y).width;
}
}
public class myEmployeeCompare : System.Collections.IComparer
{
public int Compare(object x, object y)
{
return ((VideoSize)x).width - ((VideoSize)y).width;
}
}
//你的结构体
struct VideoSize
{
public int width;
public int height;
}
//使用
VideoSize vs = new VideoSize[n];
System.Array.Sort(ss,myEmployeeCompare);