FileExtensionVector FileExtensionVector FileExtensionVector FileExtensionVector Class

Represents a random-access collection of file name extensions.

Syntax

Declaration

public sealed class FileExtensionVectorpublic sealed class FileExtensionVectorPublic NotInheritable Class FileExtensionVector

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.

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(["*"]);

Properties summary

Gets the number of file name extensions in the collection.

Methods summary

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

Removes all file name extensions from the collection.

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

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

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

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

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

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

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

Removes the last file name extension from the collection.

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

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

Properties

  • Size
    Size
    Size
    Size

    Gets the number of file name extensions in the collection.

    public uint Size { get; }public uint Size { get; }Public ReadOnly Property Size As uint

    Property Value

    • uint
      uint
      uint
      uint

      The number of file name extensions.

Methods

  • Append(System.String)
    Append(System.String)
    Append(System.String)
    Append(System.String)

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

    public void Append(System.String)public void Append(System.String)Public Function Append(System.String) As void

    Parameters

    • value
      System.String
      System.String
      System.String
      System.String

      The file name extension to append.

  • Clear()
    Clear()
    Clear()
    Clear()

    Removes all file name extensions from the collection.

    public void Clear()public void Clear()Public Function Clear() As void
  • First()
    First()
    First()
    First()

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

    public IIterator<string> First()public IIterator<string> First()Public Function First() As IIterator( Of string )

    Returns

    • The iterator.

  • GetAt(System.UInt32)
    GetAt(System.UInt32)
    GetAt(System.UInt32)
    GetAt(System.UInt32)

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

    public string GetAt(System.UInt32)public string GetAt(System.UInt32)Public Function GetAt(System.UInt32) As string

    Parameters

    • index
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

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

    Returns

    • string
      string
      string
      string

      The file name extension at the specified index.

  • GetMany(System.UInt32,System.String[])
    GetMany(System.UInt32,System.String[])
    GetMany(System.UInt32,System.String[])
    GetMany(System.UInt32,System.String[])

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

    public uint GetMany(System.UInt32,System.String[])public uint GetMany(System.UInt32,System.String[])Public Function GetMany(System.UInt32,System.String[]) As uint

    Parameters

    • startIndex
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

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

    • items
      System.String[]
      System.String[]
      System.String[]
      System.String[]

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

    Returns

    • uint
      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<string> GetView()public IVectorView<string> GetView()Public Function GetView() As IVectorView( Of string )

    Returns

    • The view of the collection.

  • IndexOf(System.String,System.UInt32)
    IndexOf(System.String,System.UInt32)
    IndexOf(System.String,System.UInt32)
    IndexOf(System.String,System.UInt32)

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

    public bool IndexOf(System.String,System.UInt32)public bool IndexOf(System.String,System.UInt32)Public Function IndexOf(System.String,System.UInt32) As bool

    Parameters

    • value
      System.String
      System.String
      System.String
      System.String

      The file name extension to find in the collection.

    • index
      System.UInt32
      System.UInt32
      System.UInt32
      System.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

    • bool
      bool
      bool
      bool

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

  • InsertAt(System.UInt32,System.String)
    InsertAt(System.UInt32,System.String)
    InsertAt(System.UInt32,System.String)
    InsertAt(System.UInt32,System.String)

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

    public void InsertAt(System.UInt32,System.String)public void InsertAt(System.UInt32,System.String)Public Function InsertAt(System.UInt32,System.String) As void

    Parameters

    • index
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

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

    • value
      System.String
      System.String
      System.String
      System.String

      The file name extension to insert.

  • RemoveAt(System.UInt32)
    RemoveAt(System.UInt32)
    RemoveAt(System.UInt32)
    RemoveAt(System.UInt32)

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

    public void RemoveAt(System.UInt32)public void RemoveAt(System.UInt32)Public Function RemoveAt(System.UInt32) As void

    Parameters

    • index
      System.UInt32
      System.UInt32
      System.UInt32
      System.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()public void RemoveAtEnd()Public Function RemoveAtEnd() As void
  • ReplaceAll(System.String[])
    ReplaceAll(System.String[])
    ReplaceAll(System.String[])
    ReplaceAll(System.String[])

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

    public void ReplaceAll(System.String[])public void ReplaceAll(System.String[])Public Function ReplaceAll(System.String[]) As void

    Parameters

    • items
      System.String[]
      System.String[]
      System.String[]
      System.String[]

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

  • SetAt(System.UInt32,System.String)
    SetAt(System.UInt32,System.String)
    SetAt(System.UInt32,System.String)
    SetAt(System.UInt32,System.String)

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

    public void SetAt(System.UInt32,System.String)public void SetAt(System.UInt32,System.String)Public Function SetAt(System.UInt32,System.String) As void

    Parameters

    • index
      System.UInt32
      System.UInt32
      System.UInt32
      System.UInt32

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

    • value
      System.String
      System.String
      System.String
      System.String

      The file name extension.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute

Details

Assembly

Windows.Storage.Pickers.dll