Sprinkling some C#6 fairy dust on FluentPath

I moved my FluentPath library’s source code from CodePlex to GitHub, and while I was at it, I vacuumed a bit, removed the cobwebs, and decided to see what applying some C#6 goodness would do to my code. Usually, I would not advise anyone to touch existing, working code that way just for the sake of using the new features: if it ain’t broke… But I wanted to kick the tires, you know? Just don’t start sending people pull request with that sort of crap, that would just be rude ;)

There were a few places where I was able to replace String.Format with string interpolation, but those are not great examples because those strings should be localizable, ideally, something with which interpolation won’t help much.

The biggest benefit for this library really was using expression-bodied members wherever it made sense. For example, this:

public static T Root {
  get {
    return Create(System.IO.Path.GetPathRoot(Current.ToString()));
  }
}

Can now be written this way:

public static T Root => Create(System.IO.Path.GetPathRoot(Current.ToString()));

Much terser and easier on the eyes, no?

You can check out the whole changesets here and here.

No Comments