Hacker News new | ask | show | jobs
by sedatk 659 days ago
Then it’s just this with C#:

  public byte[] Read(string path) => File.ReadAllBytes(path);
I think the article’s trying to explain a concept using an arbitrary piece of code from stdlib, not necessarily that specific scenario (opening and reading all bytes from a file).
2 comments

This. In general, standard library is a poor example as it has to serve very wide range of scenarios, be robust to many environmental conditions when IO is involved and perform optimally. If it's terse enough while doing so, it's good enough already.
well no need for the sub wrapper really

  say $path.IO.slurp: :bin