Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. public class Color
  2. {
  3. private static string[] _colors = {"Red", "Green", "Blue"};
  4. public static int Index { get; set; }
  5.  
  6. public static string GetNextColor()
  7. {
  8. var retVal = _colors[Index];
  9.  
  10. Index++;
  11.  
  12. return retVal;
  13. }
  14. }
  15.  
  16. [HttpGet]
  17. public string TestColor()
  18. {
  19. Color.Index = 0;
  20. return string.Format("First color: {0} Second color: {1} Third color: {2}", Color.GetNextColor(), Color.GetNextColor(), Color.GetNextColor());
  21. }
  22.  
  23. <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">
  24. First color: Red Second color: Green Third color: Blue
  25. </string>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement