divide range values into groups, for example if the range between 0 and 100 and i have four groups A,B,C,D. if i want to divide the range into four groups like 0-25 group D 26
Here is some more sample code to help you out:
var groups = new[] { "A", "B", "C", "D" };
//Range size and group size is configurable, should work with any range.
var range = Enumerable.Range(0, 1000).ToArray();
var groupSize = range.Length / groups.Length;
// Here we split range in groups. If range size is not exactly divisible
// to groups size, all left elements go to the last group, then we form
// a dictionary with labels as keys and array of numbers as values
var split = range
.GroupBy(c => Math.Min(c / groupSize, groups.Length - 1))
.ToDictionary(c => groups[c.Key], c => c.ToArray());
Console.WriteLine(String.Join(" ", ranges["A"]));