JUtils
A unity utilities library
JUtils.RangeExtensions Class Reference

Used to turn a range or int to a RangeEnumerator so it can be used in a Foreach loop More...

Static Public Member Functions

static RangeEnumerator GetEnumerator (this Range range)
 
static RangeEnumerator GetEnumerator (this int end)
 

Detailed Description

Used to turn a range or int to a RangeEnumerator so it can be used in a Foreach loop

namespace Example
{
public class RangeExample : MonoBehaviour
{
private void Start()
{
foreach (int i in 10) {} // Loop from 0 > 9
foreach (int i in ..10) {} // Loop from 0 > 10
foreach (int i in 10..) {} // Loop from 10 > 0
foreach (int i in 20..^10) {} // Loop from 20 > 10
foreach (int i in ^0..10) {} // Loop from 0 > 9
foreach (int i in ^10..^0) {} // Loop from 9 > 0
}
}
}

Member Function Documentation

◆ GetEnumerator() [1/2]

static RangeEnumerator JUtils.RangeExtensions.GetEnumerator ( this int  end)
inlinestatic

◆ GetEnumerator() [2/2]

static RangeEnumerator JUtils.RangeExtensions.GetEnumerator ( this Range  range)
inlinestatic

The documentation for this class was generated from the following file: