Save on typing while using UTF8 encoding Typing in something like Encoding.UTF8.GetString(...) and Encoding.UTF8.GetBytes(...) everywhere in your code could be eliminated by a helper UTF8 type:

public class UTF8_Should
{
    [Test]
    public void Convert()
    {
        var text = "Hello World";
        byte[] array = (UTF8)text;
        string copy = (UTF8)array;
        Assert.AreEqual(text, copy);
    }
}


Where:

struct UTF8
{
    public static implicit operator UTF8(byte[] array) =&gt; new UTF8(Encoding.UTF8.GetString(array));
    public static implicit operator string(UTF8 utf8) =&gt; utf8.Text;
    public static implicit operator UTF8(string text) =&gt; new UTF8(text);
    public static implicit operator byte[](UTF8 utf8) =&gt; Encoding.UTF8.GetBytes(utf8.Text);
    public UTF8(string text) =&gt; Text = text;
    string Text { get; }
}
You don't care about null references?



IMO you create an object in order just to do something, that is more suitable for the concept of extensions:

  public static class StringExtensions
  {
    public static byte[] ToUTF8Bytes(this string text)
    {
      return Encoding.UTF8.GetBytes(text);
    }

    public static string ToUTF8(this byte[] bytes)
    {
      return Encoding.UTF8.GetString(bytes);
    }
  }



  Assert.AreEqual(text, text.ToUTF8Bytes().ToUTF8());


The benefit of the extension methods is that you don't have to remember that you've created the UTF8 struct somewhere, because it will show up in the intellisence.