Created
May 10, 2012 04:23
-
-
Save hidori/2651023 to your computer and use it in GitHub Desktop.
Blding string simply
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
using System; | |
using System.Text; | |
namespace Mjollnir | |
{ | |
static class StringFactory | |
{ | |
public static string Create(Action<StringBuilder> action) | |
{ | |
if (action == null) throw new ArgumentNullException("action"); | |
var sb = new StringBuilder(); | |
action(sb); | |
return sb.ToString(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
var text = StringFactory.Create(stream =>
{
stream.WriteByte(0x030);
stream.WriteByte(0x031);
stream.WriteByte(0x032);
});