Skip to content

Instantly share code, notes, and snippets.

@hidori
Created May 10, 2012 04:23
Show Gist options
  • Save hidori/2651023 to your computer and use it in GitHub Desktop.
Save hidori/2651023 to your computer and use it in GitHub Desktop.
Blding string simply
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();
}
}
}
@hidori
Copy link
Author

hidori commented Feb 1, 2013

var text = StringFactory.Create(stream =>
{
stream.WriteByte(0x030);
stream.WriteByte(0x031);
stream.WriteByte(0x032);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment