Created
October 28, 2011 23:57
-
-
Save emiaj/1323872 to your computer and use it in GitHub Desktop.
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 AssetFilesKey | |
| { | |
| private readonly List<string> _names; | |
| private readonly List<string> _sortedNames; | |
| public AssetFilesKey(IEnumerable<string> names) | |
| { | |
| _names = names.ToList(); | |
| _sortedNames = _names.OrderBy(x => x).ToList(); | |
| //_names.Sort(); | |
| } | |
| public List<string> Names | |
| { | |
| get { return _names; } | |
| } | |
| public bool Equals(AssetFilesKey other) | |
| { | |
| if (ReferenceEquals(null, other)) return false; | |
| if (ReferenceEquals(this, other)) return true; | |
| if (other._names.Count != _names.Count) return false; | |
| return !other._sortedNames.Where((t, i) => t != _sortedNames[i]).Any(); | |
| } | |
| public override bool Equals(object obj) | |
| { | |
| if (ReferenceEquals(null, obj)) return false; | |
| if (ReferenceEquals(this, obj)) return true; | |
| if (obj.GetType() != typeof (AssetFilesKey)) return false; | |
| return Equals((AssetFilesKey) obj); | |
| } | |
| public override int GetHashCode() | |
| { | |
| return (_names != null ? _names.Join("-").GetHashCode() : 0); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment