//定義一個IComparer,去指定比較哪個元素
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);