ResourceMap.TryGetValue 메서드

정의

오버로드

TryGetValue(String)

기본 컨텍스트 내에서 리소스 식별자에 의해 지정된 리소스에 가장 적합한 후보를 찾으려고 시도합니다.

TryGetValue(String, ResourceContext)

제공된 컨텍스트에 대한 리소스 식별자에 의해 지정된 리소스에 가장 적합한 후보를 찾으려고 시도합니다.

TryGetValue(String)

기본 컨텍스트 내에서 리소스 식별자에 의해 지정된 리소스에 가장 적합한 후보를 찾으려고 시도합니다.

public:
 virtual ResourceCandidate ^ TryGetValue(Platform::String ^ resource) = TryGetValue;
/// [Windows.Foundation.Metadata.Overload("TryGetValue")]
ResourceCandidate TryGetValue(winrt::hstring const& resource);
[Windows.Foundation.Metadata.Overload("TryGetValue")]
public ResourceCandidate TryGetValue(string resource);
function tryGetValue(resource)
Public Function TryGetValue (resource As String) As ResourceCandidate

매개 변수

resource
String

Platform::String

winrt::hstring

이름 또는 참조로 지정된 리소스 식별자입니다. 자세한 내용은 ResourceMap 클래스에 대한 설명을 참조하세요.

반환

가장 적합한 후보를 설명하는 ResourceCandidate 입니다. 지정된 리소스 식별자를 찾을 수 없는 경우 이 메서드는 null을 반환합니다.

특성

적용 대상

TryGetValue(String, ResourceContext)

제공된 컨텍스트에 대한 리소스 식별자에 의해 지정된 리소스에 가장 적합한 후보를 찾으려고 시도합니다.

public:
 virtual ResourceCandidate ^ TryGetValue(Platform::String ^ resource, ResourceContext ^ context) = TryGetValue;
/// [Windows.Foundation.Metadata.Overload("TryGetValueWithContext")]
ResourceCandidate TryGetValue(winrt::hstring const& resource, ResourceContext const& context);
[Windows.Foundation.Metadata.Overload("TryGetValueWithContext")]
public ResourceCandidate TryGetValue(string resource, ResourceContext context);
function tryGetValue(resource, context)
Public Function TryGetValue (resource As String, context As ResourceContext) As ResourceCandidate

매개 변수

resource
String

Platform::String

winrt::hstring

이름 또는 참조로 지정된 리소스입니다. 자세한 내용은 ResourceMap 클래스에 대한 설명을 참조하세요.

context
ResourceContext

가장 적합한 후보를 선택할 컨텍스트입니다.

반환

가장 적합한 후보를 설명하는 ResourceCandidate 입니다. 지정된 리소스 식별자를 찾을 수 없는 경우 이 메서드는 null을 반환합니다.

특성

설명

일부 리소스는 표시될 보기의 규모에 따라 로드되며, 앱 내의 다른 보기는 다른 배율을 가진 다른 디바이스에 표시될 수 있습니다. 눈금은 보기별 특성입니다.

TryGetValue 메서드는 런타임 컨텍스트와 관련하여 지정된 리소스에 가장 적합한 후보를 선택하므로 ResourceContext의 배율 한정자는 연결된 보기에 따라 달라지기 때문에 리소스를 사용할 뷰에서 가져온 ResourceContext 개체를 사용하여 TryGetValue를 항상 호출해야 합니다.

적용 대상