File​Extension​Vector File​Extension​Vector File​Extension​Vector File​Extension​Vector Class

Definition

Represents a random-access collection of file name extensions.

public : sealed class FileExtensionVector : IIterable, IVectorpublic sealed class FileExtensionVector : IEnumerable, IListPublic NotInheritable Class FileExtensionVector Implements IEnumerable, IList// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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");
// 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"]);
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.List;
openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
openPicker.FileTypeFilter.Add("*");
var openPicker = new Windows.Storage.Pickers.FileOpenPicker();
openPicker.viewMode = Windows.Storage.Pickers.PickerViewMode.list;
openPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.documentsLibrary;
openPicker.fileTypeFilter.replaceAll(["*"]);

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

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

Gets or sets the element at the specified index.

This member is not implemented in C++T this[int index] { get; set; }Property Item(index As Integer) As TT this[int index] { get; set; }
Parameters
index

The zero-based index of the element to get or set.

Value
T T T T

The element at the specified index.

Exceptions

index is not a valid index in the System.Collections.Generic.IList`1.

The property is set and the System.Collections.Generic.IList`1 is read-only.

Size Size Size Size

Gets the number of file name extensions in the collection.

public : unsigned short Size { get; }This member is not implemented in C#This member is not implemented in VB.Net// You can use this property in JavaScript.
Value
unsigned short uint uint uint

The number of file name extensions.

Methods

Append(String) Append(String) Append(String) Append(String)

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

public : void Append(PlatForm::String value)This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
Parameters
value
PlatForm::String String String String

The file name extension to append.

Clear() Clear() Clear() Clear()

Removes all file name extensions from the collection.

public : void Clear()This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.

First() First() First() First()

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

public : IIterator<PlatForm::String> First()This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
Returns

The iterator.

GetAt(UInt32) GetAt(UInt32) GetAt(UInt32) GetAt(UInt32)

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

public : PlatForm::String GetAt(unsigned int index)This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
Parameters
index
unsigned int UInt32 UInt32 UInt32

The zero-based index of the file name extension to retrieve.

Returns
PlatForm::String string string string

The file name extension at the specified index.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator that iterates through the collection.

This member is not implemented in C++IEnumerator<T> GetEnumerator()Function GetEnumerator As IEnumerator(Of T)IEnumerator<T> GetEnumerator()
Returns

An enumerator that can be used to iterate through the collection.

GetMany(UInt32, String[]) GetMany(UInt32, String[]) GetMany(UInt32, String[]) GetMany(UInt32, String[])

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

public : unsigned short GetMany(unsigned int startIndex, PlatForm::String[] items)This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
Parameters
startIndex
unsigned int UInt32 UInt32 UInt32

The zero-based index of the start of the file name extensions in the collection to retrieve.

items
PlatForm::String[] String[] String[] String[]

The file name extensions in the collection that start at startIndex.

Returns
unsigned short uint uint uint

The number of items retrieved.

GetView() GetView() GetView() GetView()

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

public : IVectorView<PlatForm::String> GetView()This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
Returns
IVectorView<PlatForm::String> IReadOnlyList<string> IReadOnlyList<string> IReadOnlyList<string>

The view of the collection.

IndexOf(T) IndexOf(T) IndexOf(T) IndexOf(T)

Determines the index of a specific item in the System.Collections.Generic.IList`1.

This member is not implemented in C++int IndexOf(T item)Function IndexOf(item As T) As Integerint IndexOf(T item)
Parameters
item
T T T T

The object to locate in the System.Collections.Generic.IList`1.

Returns

The index of item if found in the list; otherwise, -1.

IndexOf(String, UInt32) IndexOf(String, UInt32) IndexOf(String, UInt32) IndexOf(String, UInt32)

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

public : PlatForm::Boolean IndexOf(PlatForm::String value, unsigned int index)This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
Parameters
value
PlatForm::String String String String

The file name extension to find in the collection.

index
unsigned int UInt32 UInt32 UInt32

The zero-based index of the file name extension if found. This parameter is set to zero if the file name extension is not found.

Returns
PlatForm::Boolean bool bool bool

True if the file name extension is found; otherwise FALSE.

Insert(Int32, T) Insert(Int32, T) Insert(Int32, T) Insert(Int32, T)

Inserts an item to the System.Collections.Generic.IList`1 at the specified index.

This member is not implemented in C++void Insert(int index, T item)Sub Insert(index As Integer, item As T)void Insert(int index, T item)
Parameters
index

The zero-based index at which item should be inserted.

item
T T T T

The object to insert into the System.Collections.Generic.IList`1.

Exceptions

index is not a valid index in the System.Collections.Generic.IList`1.

The System.Collections.Generic.IList`1 is read-only.

InsertAt(UInt32, String) InsertAt(UInt32, String) InsertAt(UInt32, String) InsertAt(UInt32, String)

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

public : void InsertAt(unsigned int index, PlatForm::String value)This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
Parameters
index
unsigned int UInt32 UInt32 UInt32

Zero-based index of the location at which to insert the file name extension.

value
PlatForm::String String String String

The file name extension to insert.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

Removes the System.Collections.Generic.IList`1 item at the specified index.

This member is not implemented in C++void RemoveAt(int index)Sub RemoveAt(index As Integer)void RemoveAt(int index)
Parameters
index

The zero-based index of the item to remove.

Exceptions

index is not a valid index in the System.Collections.Generic.IList`1.

The System.Collections.Generic.IList`1 is read-only.

RemoveAt(UInt32) RemoveAt(UInt32) RemoveAt(UInt32) RemoveAt(UInt32)

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

public : void RemoveAt(unsigned int index)This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
Parameters
index
unsigned int UInt32 UInt32 UInt32

The zero-based index of the file name extension to remove.

RemoveAtEnd() RemoveAtEnd() RemoveAtEnd() RemoveAtEnd()

Removes the last file name extension from the collection.

public : void RemoveAtEnd()This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.

ReplaceAll(String[]) ReplaceAll(String[]) ReplaceAll(String[]) ReplaceAll(String[])

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

public : void ReplaceAll(PlatForm::String[] items)This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
Parameters
items
PlatForm::String[] String[] String[] String[]

The collection of file name extensions to put in the vector.

SetAt(UInt32, String) SetAt(UInt32, String) SetAt(UInt32, String) SetAt(UInt32, String)

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

public : void SetAt(unsigned int index, PlatForm::String value)This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
Parameters
index
unsigned int UInt32 UInt32 UInt32

The zero-based index of the location at which to set the file name extension.

value
PlatForm::String String String String

The file name extension.

See Also