Repository: files-community/Files
File: src/Files.App/Actions/FileSystem/Transfer/BaseTransferItemAction.cs (C#)

Code before:
					}
					else
					{
						if (type is DataPackageOperation.Move)
						{
							// Dim opacities accordingly
							await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(() =>
							{
								listedItem.Opacity = Constants.UI.DimItemOpacity;
							});
						}

						FilesystemResult? result =
							listedItem.PrimaryItemAttribute == StorageItemTypes.File || listedItem is ZipItem
								? await ContentPageContext.ShellPage.ShellViewModel.GetFileFromPathAsync(listedItem.ItemPath).OnSuccess(t => items.Add(t))
								: await ContentPageContext.ShellPage.ShellViewModel.GetFolderFromPathAsync(listedItem.ItemPath).OnSuccess(t => items.Add(t));

						if (!result)
							throw new IOException($"Failed to process {listedItem.ItemPath} in cutting/copying to the clipboard.", (int)result.ErrorCode);
					}
				},
				10,
				statusCenterItem?.CancellationToken ?? default);

				var standardObjectsOnly = items.All(x => x is StorageFile or StorageFolder or SystemStorageFile or SystemStorageFolder);
				if (standardObjectsOnly)
					items = new ConcurrentBag<IStorageItem>(await items.ToStandardStorageItemsAsync());

				if (items.IsEmpty)
					return;

				dataPackage.Properties.PackageFamilyName = Windows.ApplicationModel.Package.Current.Id.FamilyName;
				dataPackage.SetStorageItems(items, false);

				Clipboard.SetContent(dataPackage);
			}
			catch (Exception ex)
			{
				dataPackage = default;

				if ((FileSystemStatusCode)ex.HResult is FileSystemStatusCode.Unauthorized)
				{
					string[] filePaths = ContentPageContext.SelectedItems.Select(x => x.ItemPath).ToArray();
					await FileOperationsHelpers.SetClipboard(filePaths, type);

					return;
				}

				// Reset cut mode
				ContentPageContext.ShellPage.SlimContentPage.ItemManipulationModel.RefreshItemsOpacity();


Review comment (performance):
Just a note: using StorageFile and/or StorageFolder for `DataPackage.SetStorageItems` method is fair enough since what this way produces is the exactly same as what File Explorer produces. However, as we’re in a move of avoiding WinRT APIs in an aspect of slowness, I may want to create our own service using Win32 API or store path strings instead of objects of WinRT. With that’s said we could create converter to WinRT objects in order to avoid such hard work.

Code after:
							items.Add(await ftpItem.ToStorageItem());
					}
					else
					{
						if (type is DataPackageOperation.Move)
						{
							// Dim opacities accordingly
							await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(() =>
							{
								listedItem.Opacity = Constants.UI.DimItemOpacity;
							});
						}

						FilesystemResult? result =
							listedItem.PrimaryItemAttribute == StorageItemTypes.File || listedItem is ZipItem
								? await ContentPageContext.ShellPage.ShellViewModel.GetFileFromPathAsync(listedItem.ItemPath).OnSuccess(t => items.Add(t))
								: await ContentPageContext.ShellPage.ShellViewModel.GetFolderFromPathAsync(listedItem.ItemPath).OnSuccess(t => items.Add(t));

						if (!result)
							throw new IOException($"Failed to process {listedItem.ItemPath} in cutting/copying to the clipboard.", (int)result.ErrorCode);
					}
				},
				10,
				statusCenterItem?.CancellationToken ?? default);

				var standardObjectsOnly = items.All(x => x is StorageFile or StorageFolder or SystemStorageFile or SystemStorageFolder);
				if (standardObjectsOnly)
					items = new ConcurrentBag<IStorageItem>(await items.ToStandardStorageItemsAsync());

				if (items.IsEmpty)
					return;

				dataPackage.Properties.PackageFamilyName = Windows.ApplicationModel.Package.Current.Id.FamilyName;
				dataPackage.SetStorageItems(items, false);

				Clipboard.SetContent(dataPackage);
			}
			catch (Exception ex)
			{
				dataPackage = default;

				if (ex is not IOException)
					App.Logger.LogWarning(ex, "Failed to process cutting/copying due to an unknown error.");

				if ((FileSystemStatusCode)ex.HResult is FileSystemStatusCode.Unauthorized)
				{
					string[] filePaths = ContentPageContext.SelectedItems.Select(x => x.ItemPath).ToArray();
					await FileOperationsHelpers.SetClipboard(filePaths, type);

					return;
				}