https://github.com/mrstebo/integerextensions.upto
A nicer read than Enumerable.Range.
https://github.com/mrstebo/integerextensions.upto
extension integer range ruby upto
Last synced: 2 months ago
JSON representation
A nicer read than Enumerable.Range.
- Host: GitHub
- URL: https://github.com/mrstebo/integerextensions.upto
- Owner: mrstebo
- License: mit
- Created: 2018-02-18T21:56:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-18T23:34:52.000Z (over 8 years ago)
- Last Synced: 2025-01-28T10:36:25.385Z (over 1 year ago)
- Topics: extension, integer, range, ruby, upto
- Language: C#
- Size: 14.6 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# IntegerExtensions.UpTo
A nicer read than Enumerable.Range.
[](https://ci.appveyor.com/project/mrstebo/integerextensions-upto/branch/master)
[](https://coveralls.io/github/mrstebo/IntegerExtensions.UpTo?branch=master)
[](https://www.nuget.org/packages/IntegerExtensions.UpTo/)
This package is available via install the [NuGet](https://www.nuget.org/packages/IntegerExtensions.UpTo):
```powershell
Install-Package IntegerExtensions.UpTo
```
## Basic usage
This is a port of Ruby's `upto` method.
```ruby
1.upto(5).to_a # [1, 2, 3, 4, 5]
2.upto(1).to_a # []
```
*can be done like so,*
```cs
1.UpTo(5).ToArray(); // [1, 2, 3, 4, 5]
2.UpTo(1).ToArray(); // []
```
*`UpTo` returns an `IEnumerable`, so you can easily use Linq methods with it.*