public override object Invoke(object[] args) { var path = args[0].ToString(); if (string.IsNullOrWhiteSpace(path)) { return(null); } var pattern = new PathPattern(path); var parent = pattern.GetParent(); return(parent?.Text); }