FileExtensionVector class

Applies to Windows and Windows Phone

Represents a random-access collection of file name extensions.

Syntax


var fileExtensionVector = fileOpenPicker.fileTypeFilter;
var fileExtensionVector = folderPicker.fileTypeFilter;

Attributes

[Version(0x06020000)]

Members

The FileExtensionVector class has these types of members:

Methods

The FileExtensionVector class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
Add [C#, VB]Adds a new item to the collection.
Append [C++, JavaScript]Appends a file name extension to the end of the collection.
Clear Removes all file name extensions from the collection.
Contains [C#, VB]Determines whether an element is in the collection.
CopyTo [C#, VB]Copies the elements of the collection to an array, starting at a particular array index.
First [C++, JavaScript]Retrieves an iterator that iterates through the file name extensions in the collection.
GetAt [C++, JavaScript]Retrieves the file name extension at the specified index in the collection.
GetMany [C++, JavaScript]Retrieves the file name extensions that start at the specified index in the collection.
GetView [C++, JavaScript]Retrieves an immutable view of the collection of file name extensions.
IndexOf [C++, JavaScript]Retrieves the index of a specified file name extension in the collection.
IndexOf [C#, VB]Determines the index of a specific item in the collection.
Insert [C#, VB]Inserts an item into the collection at the specified index.
InsertAt [C++, JavaScript]Inserts a file name extension into a collection at a specified index.
Remove [C#, VB]Removes the first occurrence of a specific object from the collection.
RemoveAt [C++, JavaScript]Removes the file name extension at the specified index in the collection.
RemoveAt [C#, VB]Removes the element at the specified index of the collection.
RemoveAtEnd [C++, JavaScript]Removes the last file name extension from the collection.
ReplaceAll [C++, JavaScript]Replaces all file name extensions in the collection with the specified file name extensions.
SetAt [C++, JavaScript]Sets the file name extension at the specified index of the collection.

 

Properties

The FileExtensionVector class has these properties.

PropertyAccess typeDescription

Count [C#, VB]

Read-onlyGets the number of elements contained in the collection.

IsReadOnly [C#, VB]

Read-onlyGets a value indicating whether the collection is read-only.

Item [C#, VB]

Read/writeGets or sets the element at the specified index.

Size [C++, JavaScript]

Read-onlyGets the number of file name extensions in the collection.

 

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.

Examples

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


// Create the picker object and set options
var openPicker = new Windows.Storage.Pickers.FileOpenPicker();
openPicker.viewMode = Windows.Storage.Pickers.PickerViewMode.thumbnail;
openPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.picturesLibrary;
// Users expect to have a filtered view of their folders depending on the scenario.
// For example, when choosing a documents folder, restrict the filetypes to documents for your application.
openPicker.fileTypeFilter.replaceAll([".png", ".jpg", ".jpeg"]);


The File picker sample demonstrates how to show files of any type in the file picker for the user to pick from.


var openPicker = new Windows.Storage.Pickers.FileOpenPicker();
openPicker.viewMode = Windows.Storage.Pickers.PickerViewMode.list;
openPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.documentsLibrary;
openPicker.fileTypeFilter.replaceAll(["*"]);


Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Storage.Pickers
Windows::Storage::Pickers [C++]

Metadata

Windows.winmd

See also

File picker sample
Quickstart: Accessing files with file pickers
fileOpenPicker.fileTypeFilter property
folderPicker.fileTypeFilter property

 

 

Show:
© 2014 Microsoft. All rights reserved.