private static string[] GetFilesHelper(string path, string pattern, bool getFullPath, SearchOption option) { using (var pin = new PinCollection()) { var collectionResult = StringCollectionResult.FromNative( NativeCommon.FabricDirectoryGetFiles( pin.AddBlittable(path), pin.AddBlittable(pattern), NativeTypes.ToBOOLEAN(getFullPath), NativeTypes.ToBOOLEAN(option == SearchOption.TopDirectoryOnly)), !getFullPath); // allow duplicates string[] arrayResult = new string[collectionResult.Count]; collectionResult.CopyTo(arrayResult, 0); return(arrayResult); } }