//排序
//定义Dictionary<time,filePath>
//升序排序(OrderBy)、降序排序(OrderByDescending):
public Dictionary<int,string> GetListAndDictionary(string FilePATH)
{// return m_LogicCenter.m_Data.m_TakePhotoInfo.m_AutoSavePhotoPath + "\\" + System.IO.Path.GetFileName(new string(jobInfo.pFileUrl)) + "_" + DateTime.Now.ToString("_yyyyMMdd_HHmmss_fff") + "_" + jobInfo.pProgress.dInRawPageProgress.ToString()+".png";
string[] labFiles = Directory.GetFiles(FilePATH, "*.png?");//文件
int[] arr_PicFileTime = new int[labFiles.Length+1];
int count = 0;
Dictionary<int, string> keyValuePairs = new Dictionary<int, string>();
foreach (string s in labFiles)
{
string[] str = s.Split('_');
string time = str[1];
keyValuePairs.Add(Convert.ToInt32(time),FilePATH);
}
return keyValuePairs.OrderBy(s => s.Value).ToDictionary(p => p.Key, o => o.Value);
}
排序Lambda ->Dictionary
最新推荐文章于 2022-12-19 11:08:09 发布