Stream.Write overload that’s always been oddly missing

I’m always surprised of places that force you to pass in the offset and length into arrays.  After all, strings are just char arrays, but it’s common that you don’t have to tell API’s which subset of those chars you want to pass 🙂

It’s such a simple overload, too.  Very odd to me that it’s missing from Write.

public static void Write(this Stream self, byte[] bytes)
{
    self.Write(bytes, 0, bytes.Length);
}
Advertisements