Skip to content

Instantly share code, notes, and snippets.

@devoyster
Created December 14, 2011 21:26
Show Gist options
  • Save devoyster/1478614 to your computer and use it in GitHub Desktop.
Save devoyster/1478614 to your computer and use it in GitHub Desktop.
// Here different expression keys should be generated since parameter "value" is different
// for two expressions at the moment of their creation
int value = 1;
Expression<Func<string, string>> expr1 = s => s.Length > value ? s.Substring(0, value) : s;
int value = 2;
Expression<Func<string, string>> expr2 = s => s.Length > value ? s.Substring(0, value) : s;
// Here same expression keys should be generated since parameter value (1) is the same
// for two expressions at the moment of their creation
int value = 1;
Expression<Func<string, string>> expr1 = s => s.Length > value ? s.Substring(0, value) : s;
Expression<Func<string, string>> expr2 = s => s.Length > 1 ? s.Substring(0, 1) : s;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment