MusicProperties 클래스

정의

항목의 음악 관련 속성(예: 파일 또는 폴더)에 대한 액세스를 제공합니다.

public ref class MusicProperties sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class MusicProperties final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class MusicProperties
Public NotInheritable Class MusicProperties
상속
Object Platform::Object IInspectable MusicProperties
특성
구현

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

예제

이 예제에서는 앨범 및 등급과 같은 음악 속성을 포함하여 파일의 속성을 검색하는 방법을 보여 줍니다.

try
{
    StorageFile file = rootPage.sampleFile;
    if (file != null)
    {
        StringBuilder outputText = new StringBuilder();

        // Get music properties
        MusicProperties musicProperties = await file.Properties.GetMusicPropertiesAsync();
        outputText.AppendLine("Album: " + musicProperties.Album);
        outputText.AppendLine("Rating: " + musicProperties.Rating);
    }
}
// Handle errors with catch blocks
catch (FileNotFoundException)
{
 // For example, handle a file not found error
}

GetMusicPropertiesAsyncmusicProperties 완료되면 MusicProperties 개체를 가져옵니다.

이 예제 file 에서는 속성을 검색할 파일을 나타내는 StorageFile 을 포함합니다.

설명

항목의 Properties 속성(예: 폴더 파일)에서 GetMusicPropertiesAsync 메서드를 사용하여 MusicProperties 개체에 비동기적으로 액세스하거나 MusicProperties 속성을 사용할 수 있는 경우 동기적으로 액세스할 수 있습니다. 다음 메서드 및 속성을 사용하여 musicProperties 개체를 가져올 수 있습니다.

참고

다른 앱(예: Microsoft Word)에서 정의한 속성 처리기를 사용하여 가져오기 또는 설정된 속성에 액세스할 수 없습니다. 대신 시스템 인덱스에서 백업하는 파일 쿼리를 사용하여 이러한 속성을 가져올 수 있습니다. 자세한 내용은 QueryOptions를 참조하세요.

속성에 액세스하는 방법에 대한 자세한 코드 샘플은 파일 액세스 샘플을 참조하세요.

속성

Album

노래가 포함된 앨범의 이름을 가져오거나 설정합니다.

AlbumArtist

노래의 앨범 아티스트 이름을 가져오거나 설정합니다.

Artist

노래에 기여한 아티스트를 가져옵니다.

Bitrate

노래 파일의 비트 속도를 가져옵니다.

Composers

노래의 작곡가를 가져옵니다.

Conductors

노래의 지휘자를 가져옵니다.

Duration

노래의 기간을 밀리초 단위로 가져옵니다.

Genre

노래가 속한 음악 장르의 이름을 가져옵니다.

Producers

노래의 프로듀서를 가져옵니다.

Publisher

노래의 게시자를 가져오거나 설정합니다.

Rating

음악 파일과 연결된 등급을 가져오거나 설정합니다.

Subtitle

노래의 부제목을 가져오거나 설정합니다.

Title

노래의 제목을 가져오거나 설정합니다.

TrackNumber

노래 앨범의 노래 트랙 번호를 가져오거나 설정합니다.

Writers

작곡가를 가져옵니다.

Year

노래가 출시된 연도를 가져오거나 설정합니다.

메서드

RetrievePropertiesAsync(IIterable<String>)

항목과 연결된 지정된 음악 관련 Windows 파일 속성을 검색합니다.

SavePropertiesAsync()

항목과 연결된 모든 속성을 저장합니다.

SavePropertiesAsync(IIterable<KeyValuePair<String,Object>>)

항목과 연결된 지정된 속성 및 값을 저장합니다.

적용 대상

추가 정보