DataTable dt = new DataTable("Head");
DataColumn dc;
dc = new DataColumn();
dc.DataType = Type.GetType("System.String");
dc.ColumnName = "Name";
dt.Columns.Add(dc);
DataRow dr;
for (int i=0; i<10; i++)
{
dr = dt.NewRow();
dr["Name"] = "test" + i.ToString();
dt.Rows.Add(dr);
}
dt.Select("", "Name DESC");
listBox1.DataSource = dt;
listBox1.DisplayMember = "Name";
/*
listviewとかdatagridとかlistboxに追加するときに
こういう風に逆順にしたいけど、ソートされなくてこういう風にならない
test10
test9
test8
test7
test6
test5
test4
test3
test2
test1
test0
*/
RGF0YVRhYmxlIGR0ID0gbmV3IERhdGFUYWJsZSgiSGVhZCIpOwpEYXRhQ29sdW1uIGRjOwogCmRjID0gbmV3IERhdGFDb2x1bW4oKTsKZGMuRGF0YVR5cGUgPSBUeXBlLkdldFR5cGUoIlN5c3RlbS5TdHJpbmciKTsKZGMuQ29sdW1uTmFtZSA9ICJOYW1lIjsKZHQuQ29sdW1ucy5BZGQoZGMpOwogCkRhdGFSb3cgZHI7CmZvciAoaW50IGk9MDsgaTwxMDsgaSsrKQp7CiAgICBkciA9IGR0Lk5ld1JvdygpOwogICAgZHJbIk5hbWUiXSA9ICJ0ZXN0IiArIGkuVG9TdHJpbmcoKTsKICAgIGR0LlJvd3MuQWRkKGRyKTsKfQpkdC5TZWxlY3QoIiIsICJOYW1lIERFU0MiKTsKbGlzdEJveDEuRGF0YVNvdXJjZSA9IGR0OwpsaXN0Qm94MS5EaXNwbGF5TWVtYmVyID0gIk5hbWUiOwogCiAKLyoKbGlzdHZpZXfjgajjgYtkYXRhZ3JpZOOBqOOBi2xpc3Rib3jjgavov73liqDjgZnjgovjgajjgY3jgasK44GT44GG44GE44GG6aKo44Gr6YCG6aCG44Gr44GX44Gf44GE44GR44Gp44CB44K944O844OI44GV44KM44Gq44GP44Gm44GT44GG44GE44GG6aKo44Gr44Gq44KJ44Gq44GECnRlc3QxMAp0ZXN0OQp0ZXN0OAp0ZXN0Nwp0ZXN0Ngp0ZXN0NQp0ZXN0NAp0ZXN0Mwp0ZXN0Mgp0ZXN0MQp0ZXN0MAoqLw==