How to get reverse of a series of elements using Enumarable in C#?
问题 I have two Integer variables like int Max = 10; int limit = 5; and a Dictionary Dictionary<String , String> MyDict = new Dictionary<string,string>(); I need to fill the dictionary with Max elements and if the index is greater than or equal to limit then the value should be none. Here is my sample code which will clear my question int j = 1; for (int i = Max-1; i >= 0; i--) { if (i >= limit) MyDict.Add((j++).ToString(), "None"); else MyDict.Add((j++).ToString(), i.ToString()); } so the result