Udostępnij za pośrednictwem


FileExtensionVector Class

Definition

Represents a random-access collection of file name extensions.

public ref class FileExtensionVector sealed : IIterable<Platform::String ^>, IVector<Platform::String ^>
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class FileExtensionVector final : IIterable<winrt::hstring>, IVector<winrt::hstring>
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class FileExtensionVector final : IIterable<winrt::hstring>, IVector<winrt::hstring>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class FileExtensionVector : IEnumerable<string>, IList<string>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class FileExtensionVector : IEnumerable<string>, IList<string>
Public NotInheritable Class FileExtensionVector
Implements IEnumerable(Of String), IList(Of String)
Inheritance
Object Platform::Object IInspectable FileExtensionVector
Attributes
Implements
IEnumerable<String> IIterable<Platform::String> IIterable<winrt::hstring> IIterable<T> IEnumerable<T> IList<String> IVector<Platform::String> IVector<winrt::hstring>

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

The File picker sample demonstrates how to specify the file types that the user can see and pick from in the file picker.

FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
openPicker.FileTypeFilter.Add(".jpg");
openPicker.FileTypeFilter.Add(".jpeg");
openPicker.FileTypeFilter.Add(".png");
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.List;
openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
openPicker.FileTypeFilter.Add("*");

Remarks

Collection member lists

For JavaScript, FileExtensionVector has the members shown in the member lists. In addition, FileExtensionVector supports a length property, members of Array.prototype, and using an index to access items.

Enumerating the collection in C# or Microsoft Visual Basic

A FileExtensionVector is enumerable, so you can use language-specific syntax such as foreach in C# to enumerate the items in the collection. The compiler does the type-casting for you and you won't need to cast to IEnumerable<String> explicitly. If you do need to cast explicitly, for example if you want to call GetEnumerator, cast to IEnumerable<T> with a String constraint.

Properties

Size

Gets the number of file name extensions in the collection.

Methods

Append(String)

Appends a file name extension to the end of the collection.

Clear()

Removes all file name extensions from the collection.

First()

Retrieves an iterator that iterates through the file name extensions in the collection.

GetAt(UInt32)

Retrieves the file name extension at the specified index in the collection.

GetMany(UInt32, String[])

Retrieves the file name extensions that start at the specified index in the collection.

GetView()

Retrieves an immutable view of the collection of file name extensions.

IndexOf(String, UInt32)

Retrieves the index of a specified file name extension in the collection.

InsertAt(UInt32, String)

Inserts a file name extension into a collection at a specified index.

RemoveAt(UInt32)

Removes the file name extension at the specified index in the collection.

RemoveAtEnd()

Removes the last file name extension from the collection.

ReplaceAll(String[])

Replaces all file name extensions in the collection with the specified file name extensions.

SetAt(UInt32, String)

Sets the file name extension at the specified index of the collection.

Applies to

See also