Last active
August 29, 2015 14:24
-
-
Save ChrisMoney/90501c14580cf2bda0ca to your computer and use it in GitHub Desktop.
C# - Determine Relationship of elements in a list or array
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
| // Subtract every number in an array | |
| for(int i=0;i<arrayName.count;i++) | |
| { | |
| arrayName[i]=arrayName[i]-1; | |
| } | |
| // determine if elements are the same in an array | |
| var l = arrayName.SelectMany(_ => _); | |
| bool areSame = l.All(_ => l.FirstOrDefault() == _); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment