Created
August 10, 2012 22:10
-
-
Save cyberzed/3318545 to your computer and use it in GitHub Desktop.
Not sure this will be a sane solution...
This file contains 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 SemanticVersionComparer : IComparer<SemanticVersion> | |
{ | |
private IDictionary<VersionType, Func<SemanticVersion, SemanticVersion, int>> comparisons = | |
new Dictionary<VersionType, Func<SemanticVersion, SemanticVersion, int>>(); | |
public int Compare(SemanticVersion x, SemanticVersion y) | |
{ | |
if (x == y) | |
{ | |
return 0; | |
} | |
if (x == null) | |
{ | |
return -1; | |
} | |
if (y == null) | |
{ | |
return 1; | |
} | |
var xVersionType = x.VersionType; | |
var yVersionType = y.VersionType; | |
if (xVersionType == yVersionType) | |
{ | |
return 0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment