Skip to content

Instantly share code, notes, and snippets.

@jsvnm
Created February 29, 2012 14:10
Show Gist options
  • Save jsvnm/1941125 to your computer and use it in GitHub Desktop.
Save jsvnm/1941125 to your computer and use it in GitHub Desktop.
get next value in A..Z range using two lambdas, one Func<char> variable
static public class A_Z_cycle
{
static public Func<char> Next = () => {
const char a='A', b='Z', c=(char)(b-a+1);
int n=-1;
return (Next=(()=>(char)(a + (n=(n+1)%c))))();
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment