Created
November 28, 2022 00:32
-
-
Save scarletquasar/ba9c6110d2a63bff43eebe120deee644 to your computer and use it in GitHub Desktop.
create false 'enumerable' type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Listify | |
{ | |
public int Start { get; } | |
public int End { get; } | |
public Listify(int start, int end) | |
{ | |
Start = start; | |
End = end; | |
} | |
public int this[int index] | |
{ | |
get { | |
var value = start + index; | |
if (value > end) throw new IndexOutOfRangeException(); | |
return value; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment