Sdílet prostřednictvím


AccessListEntryView Class

Definition

A list of the entries that are in your app's most recently used list (MRU) (obtained from the static StorageApplicationPermissions.MostRecentlyUsedList property) and in your app's future-access list (obtained from the static StorageApplicationPermissions.FutureAccessList property).

public ref class AccessListEntryView sealed : IIterable<AccessListEntry>, IVectorView<AccessListEntry>
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class AccessListEntryView final : IIterable<AccessListEntry>, IVectorView<AccessListEntry>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class AccessListEntryView : IEnumerable<AccessListEntry>, IReadOnlyList<AccessListEntry>
Public NotInheritable Class AccessListEntryView
Implements IEnumerable(Of AccessListEntry), IReadOnlyList(Of AccessListEntry)
Inheritance
Object Platform::Object IInspectable AccessListEntryView
Attributes
Implements

Windows requirements

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

Examples

The File access sample demonstrates how to enumerate entries in the MostRecentlyUsedList.

AccessListEntryView entries = StorageApplicationPermissions.MostRecentlyUsedList.Entries;
if (entries.Count > 0)
{
    StringBuilder outputText = new StringBuilder("The MRU list contains the following item(s):" + Environment.NewLine + Environment.NewLine);

    foreach (AccessListEntry entry in entries)
    {
        outputText.AppendLine(entry.Metadata);
    }
}
else
{
    // Handle empty list
}
#include <sstream>
#include <winrt/Windows.Storage.AccessCache.h>
using namespace winrt;
using namespace Windows::Storage::AccessCache;
...
AccessListEntryView entries { StorageApplicationPermissions::MostRecentlyUsedList().Entries() };
if (entries.Size() > 0)
{
    std::wostringstream outputText;
    outputText << L"The MRU list contains the following item(s):" << std::endl << std::endl;

    for(AccessListEntry const& entry: entries)
    {
        outputText << entry.Metadata.c_str() << std::endl;
    }

    std::wstring outputString { outputText.str() };
}
else
{
    // Handle empty list
}

Remarks

To see more code examples that use this class, see the File access sample.

Enumerating the collection in C# or Microsoft Visual Basic

AccessListEntryView 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<AccessListEntry> explicitly. If you do need to cast explicitly, for example if you want to call GetEnumerator, cast to IEnumerable<T> with an AccessListEntry constraint.

Properties

Size

Gets the number of storage items in the access list or most recently used (MRU) list.

Methods

First()

Retrieves the first storage item from the access list or most recently used (MRU) list.

GetAt(UInt32)

Retrieves the storage item at the specified index in the access list or most recently used (MRU) list.

GetMany(UInt32, AccessListEntry[])

Retrieves the storage items that start at the specified index in the access list or most recently used (MRU) list.

IndexOf(AccessListEntry, UInt32)

Retrieves the index of the specified storage item in the access list or most recently used (MRU) list.

Applies to

See also