Enumerable.Range

  • Thread starter Thread starter Shapper
  • Start date Start date
S

Shapper

Hello,

I am trying to create a Year range as follows:

Enumerable.Range(2010, DateTime.Now.Year)

But I get a a list that goes from 2010 to 4020.

What am I doing wrong?

Thank You,

Miguel
 
I am trying to create a Year range as follows:

Enumerable.Range(2010, DateTime.Now.Year)

But I get a a list that goes from 2010 to 4020.

What am I doing wrong?

I have not checked the docs, but it seems as an obvious guess
that the second arg is not last but count, so you need to do:

Enumerable.Range(2010, DateTime.Now.Year - 2010)

Arne
 
I have not checked the docs, but it seems as an obvious guess
that the second arg is not last but count, so you need to do:

Enumerable.Range(2010, DateTime.Now.Year - 2010)

Make that:

Enumerable.Range(2010, DateTime.Now.Year - 2010 - 1)

Arne
 
 > Enumerable.Range(2010, DateTime.Now.Year - 2010)

Make that:

Enumerable.Range(2010, DateTime.Now.Year - 2010 - 1)

Arne

Of course ...

That's the problem of Copying - Pasting.

I had Enumerable.Range(1, 31) to display the days of the month ...

In this case, obviously worked.

Thanks,

Miguel
 
Back
Top