FilePickerSelectedFilesArray 클래스

정의

파일 선택기를 사용하여 사용자가 선택한 스토리지 파일의 컬렉션을 나타냅니다.

public ref class FilePickerSelectedFilesArray sealed : IIterable<StorageFile ^>, IVectorView<StorageFile ^>
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class FilePickerSelectedFilesArray final : IIterable<StorageFile>, IVectorView<StorageFile>
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class FilePickerSelectedFilesArray final : IIterable<StorageFile>, IVectorView<StorageFile>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class FilePickerSelectedFilesArray : IEnumerable<StorageFile>, IReadOnlyList<StorageFile>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class FilePickerSelectedFilesArray : IEnumerable<StorageFile>, IReadOnlyList<StorageFile>
Public NotInheritable Class FilePickerSelectedFilesArray
Implements IEnumerable(Of StorageFile), IReadOnlyList(Of StorageFile)
상속
Object Platform::Object IInspectable FilePickerSelectedFilesArray
특성
구현

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

예제

파일 선택기 샘플에서는 fileOpenPicker.pickMultipleFilesAsync를 호출한 후 선택한 파일의 filePickerSelectedFilesArray(files예제에서)를 캡처하는 방법을 보여 줍니다.

참고

앱이 스냅되지 않았는지(또는 스냅 해제될 수 있는지) 항상 확인하고 사용자가 단일 파일 또는 여러 파일을 선택하는지 여부에 관계없이 파일 선택기 속성을 설정해야 합니다.

IReadOnlyList<StorageFile> files = await openPicker.PickMultipleFilesAsync();
if (files.Count > 0)
{
    StringBuilder output = new StringBuilder("Picked files:\n");
    // Application now has read/write access to the picked file(s)
    foreach (StorageFile file in files)
    {
        output.Append(file.Name + "\n");
    }
    OutputTextBlock.Text = output.ToString();
}
else
{
    OutputTextBlock.Text = "Operation cancelled.";
}

설명

fileOpenPicker.pickMultipleFilesAsync 메서드에 대한 호출이 성공적으로 완료되면 사용자가 선택한 모든 파일이 포함된 filePickerSelectedFilesArray 개체를 반환합니다. 이 배열에서 선택한 파일은 storageFile 개체로 표시됩니다.

컬렉션 멤버 목록

JavaScript의 경우 FilePickerSelectedFilesArray에는 멤버 목록에 표시된 멤버가 있습니다. 또한 FilePickerSelectedFilesArray는 length 속성, Array.prototype의 멤버 및 인덱스를 사용하여 항목에 액세스할 수 있도록 지원합니다.

C# 또는 Microsoft Visual Basic에서 컬렉션 열거

FilePickerSelectedFilesArray는 열거 가능하므로 C#의 foreach 와 같은 언어별 구문을 사용하여 컬렉션의 항목을 열거할 수 있습니다. 컴파일러는 형식 캐스팅을 수행하며 명시적으로 로 캐스팅 IEnumerable<StorageFile> 할 필요가 없습니다. 예를 들어 GetEnumerator를 호출하려는 경우 명시적으로 캐스팅해야 하는 경우 StorageFile 제약 조건을 사용하여 IEnumerable<T>로 캐스팅합니다.

속성

Size

컬렉션의 StorageFile 개체 수를 가져옵니다.

메서드

First()

선택한 파일을 나타내는 StorageFile 개체의 컬렉션을 반복하는 반복기를 검색합니다.

GetAt(UInt32)

컬렉션의 지정된 인덱스에서 StorageFile 개체를 반환합니다.

GetMany(UInt32, StorageFile[])

컬렉션의 지정된 인덱스에서 시작하는 StorageFile 개체를 검색합니다.

IndexOf(StorageFile, UInt32)

컬렉션에서 지정된 StorageFile 개체의 인덱스를 검색합니다.

적용 대상

추가 정보