Created
April 4, 2018 08:44
-
-
Save bogdanbujdea/d796fff80528019a708d8007aaefbfaf to your computer and use it in GitHub Desktop.
Get first member that is not ordered correctly
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
| private static ISymbol GetUnorderedMember(List<ISymbol> members) | |
| { | |
| //I'm just sorting the members by DeclaredAccessibility, then comparing them with the order of | |
| //the initial members | |
| var orderedByAccessibility = members.OrderByDescending(m => m.DeclaredAccessibility).ToList(); | |
| for (var i = 0; i < members.Count; i++) | |
| { | |
| if (members[i].DeclaredAccessibility != orderedByAccessibility[i].DeclaredAccessibility) | |
| { | |
| if (orderedByAccessibility[i].DeclaredAccessibility < members[i].DeclaredAccessibility) | |
| { | |
| return members[i]; | |
| } | |
| } | |
| } | |
| return null; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment