Created
February 3, 2012 21:17
-
-
Save NickLarsen/1732673 to your computer and use it in GitHub Desktop.
Id helper for unit testing to ensure all objects have unique ids
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 static class IdHelper | |
{ | |
private static int CurrentId = 0; | |
public static int NextId() | |
{ | |
var newId = Interlocked.Increment(ref CurrentId); | |
return newId; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment