小编Mar*_*iko的帖子

按字母顺序排序列表

我有以下课程:

class Detail
{
    public Detail()
    {
        _details = new List<string>();
    }
    public IList<string> Details { get { return _details; } }
    private readonly List<string> _details;
}
Run Code Online (Sandbox Code Playgroud)

目前我使用以下方法随机对类进行排序:

void ShuffleGenericList<T>(IList<T> list)
{
    //generate a Random instance
    var rnd = new Random();
    //get the count of items in the list
    var i = list.Count();
    //do we have a reference type or a value type
    T val = default(T);

    //we will loop through the list backwards
    while (i >= 1)
    {
        //decrement …
Run Code Online (Sandbox Code Playgroud)

.net c# linq sorting

74
推荐指数
4
解决办法
18万
查看次数

标签 统计

.net ×1

c# ×1

linq ×1

sorting ×1