Advertisement
Guest User

Untitled

a guest
May 28th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. //Join
  2. topicString = String.Join(", ", user.Topics)
  3. (note that Topics.ToString returns a 3 character ID)
  4.  
  5. //StringBuilder
  6. StringBuilder stringBuilder = new StringBuilder(3*user.Topics.Count() + 2*user.Topics.Count());
  7. foreach(var topic in user.Topics) {
  8. stringBuilder.Append(topic.Code);
  9. stringBuilder.Append(", ");
  10. }
  11. codes = stringBuilder.ToString();
  12. codes = codes.Remove(codes.Length-2);
  13.  
  14.  
  15. //Classic concatenation
  16. foreach(var topic in user.Topics) {
  17. codes += topic.Code;
  18. codes += ", ";
  19. }
  20. codes = codes.Remove(codes.Length-2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement