I am initializing a List<int> in a constructor by storing two simple constants, MinValue and MaxValue as such:
private const int MinValue = 1;
private const int MaxValue = 100;
private List<int> integerList = new List<int>();
public Class()
{
for (int i = MinValue ; i < MaxValue ; i++)
{
integerList .Add(i);
}
}
Is there a way to just initialize the list with a simple LINQ query? Since a List<T> can be constructed with an IEnumerable<T>, does a query of the following form exist?
private List<int> integerList = new List<int>(<insert query here>);
Is this even possible?
This can be achieved using
Enumerable.Range