diff --git a/System/Path.cs b/System/Path.cs index 8a359483..bda8f31a 100644 --- a/System/Path.cs +++ b/System/Path.cs @@ -182,11 +182,7 @@ namespace Vanara.IO /// /// The UNC path. /// On success, the server portion of the UNC path. On failure, is returned. - public static string GetUNCServer(string path) - { - var sb = new StringBuilder(MAX_PATH, MAX_PATH); - return PathIsUNCEx(path, ref sb) ? sb.ToString() : null; - } + public static string GetUNCServer(string path) => PathIsUNCEx(path, out var ptr) ? StringHelper.GetString(ptr, System.Runtime.InteropServices.CharSet.Unicode, path.Length) : null; /// /// Searches a path to determine if it contains a valid prefix of the type passed by . A prefix is one of