我有一个根本没有排序的列表。我使用了 .Sort 并且无法正常工作。我希望数字按降序排序。9,6,4,3,2
List<string> tem = new List<string>();
using (SqlConnection cs = new SqlConnection(connStr))
{
cs.Open();
for (int x = 0; x < length; x++)
{
SqlCommand select = new SqlCommand("spTicketIssuance_GetTransactions", cs);
select.CommandType = System.Data.CommandType.StoredProcedure;
select.Parameters.AddWithValue("@TransDesc", TransType[x]);
SqlDataReader dr = select.ExecuteReader();
while (dr.Read())
{
tem.Add(dr["TransTime"].ToString()); //Adds all Transaction in the multiline textbox and adds them to List TransList
}
dr.Close();
}
tem.Sort(); //NOT SORTING
cs.Close();
}