list クラス : Sort(bool) メソッド
説明
呼び出し元リストをソートした新しいリストを取得します。
構文
listInstance.Sort(bool order)
引数
| クラス | 名前 | 説明 |
| bool | order | 並び順。 |
返り値
| クラス | 説明 |
| sorted list | ソートされた新しいリスト。 |
サンプルコード
| 1: | list{int} intList = new list{int}(); |
| 2: | intList.Add(3); |
| 3: | intList.Add(2); |
| 4: | intList.Add(1); |
| 5: | list{int} newList = intList.Sort(true); // 返り値のリストの順序は1、2、3になります。 |
注意
このメソッドはVer 1.1.0.0 で追加されました。
引数が true の場合、返り値のリストは昇順にソートされます。それ以外の場合、降順にソートされます。
呼び出し元リストをソートした新しいリストが返ります。呼び出し元のリストの並び順は変化しません。
返り値のリストは呼び出し元リストの浅いコピーです。
list{int}、list{long}、list{real}、list{bool}、list{string}以外のlistで、このメソッドを呼び出すと例外(RtypeException)がスローされます。
参照リンク
無し


