Enumerable.Range

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
 
A

Arne Vajhøj

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
 
A

Arne Vajhøj

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
 
S

Shapper

 > 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top