AppDomain.GetData(String) 메서드

정의

지정한 이름에 대해 현재 애플리케이션 도메인에 저장된 값을 가져옵니다.

public:
 System::Object ^ GetData(System::String ^ name);
public:
 virtual System::Object ^ GetData(System::String ^ name);
public object? GetData (string name);
public object GetData (string name);
member this.GetData : string -> obj
abstract member GetData : string -> obj
override this.GetData : string -> obj
Public Function GetData (name As String) As Object

매개 변수

name
String

미리 정의된 애플리케이션 도메인 속성의 이름 또는 사용자가 정의한 애플리케이션 도메인 속성의 이름입니다.

반환

name 속성의 값이거나, 속성이 없을 경우 null입니다.

구현

예외

name이(가) null인 경우

언로드된 애플리케이션 도메인에서 작업이 시도됩니다.

예제

다음 예제에서는 새 애플리케이션 도메인을 만들고, 도메인에 대해 시스템이 제공한 값을 설정 및 도메인에 대 한 새 값 쌍을 추가 합니다. 그런 다음, 메서드를 사용하여 GetData 이러한 값 쌍에서 데이터를 검색하고 콘솔에 표시하는 방법을 보여 줍니다.

using namespace System;
using namespace System::Reflection;

int main()
{
   // appdomain setup information
   AppDomain^ currentDomain = AppDomain::CurrentDomain;
   
   //Create a new value pair for the appdomain
   currentDomain->SetData( "ADVALUE", "Example value" );
   
   //get the value specified in the setdata method
   Console::WriteLine( "ADVALUE is: {0}", currentDomain->GetData( "ADVALUE" ) );
   
   //get a system value specified at appdomainsetup
   Console::WriteLine( "System value for loader optimization: {0}", 
      currentDomain->GetData( "LOADER_OPTIMIZATION" ) );
}

/* This code example produces the following output:

ADVALUE is: Example value
System value for loader optimization: NotSpecified
 */
using System;
using System.Reflection;

class ADGetData
{
    public static void Main()
    {
        // appdomain setup information
        AppDomain currentDomain = AppDomain.CurrentDomain;

        //Create a new value pair for the appdomain
        currentDomain.SetData("ADVALUE", "Example value");

        //get the value specified in the setdata method
        Console.WriteLine("ADVALUE is: " + currentDomain.GetData("ADVALUE"));

        //get a system value specified at appdomainsetup
        Console.WriteLine("System value for loader optimization: {0}",
            currentDomain.GetData("LOADER_OPTIMIZATION"));
    }
}

/* This code example produces the following output:

ADVALUE is: Example value
System value for loader optimization: NotSpecified
 */
open System

// appdomain setup information
let currentDomain = AppDomain.CurrentDomain

//Create a new value pair for the appdomain
currentDomain.SetData("ADVALUE", "Example value")

//get the value specified in the setdata method
currentDomain.GetData "ADVALUE"
|> printfn "ADVALUE is: %O"

//get a system value specified at appdomainsetup
currentDomain.GetData "LOADER_OPTIMIZATION"
|> printfn "System value for loader optimization: %O"

(* This code example produces the following output:

ADVALUE is: Example value
System value for loader optimization: NotSpecified
*)
Imports System.Reflection

Class ADGetData   
   
   Public Shared Sub Main()
      ' appdomain setup information
      Dim currentDomain As AppDomain = AppDomain.CurrentDomain
      
      'Create a new value pair for the appdomain
      currentDomain.SetData("ADVALUE", "Example value")
      
      'get the value specified in the setdata method
      Console.WriteLine(("ADVALUE is: " & currentDomain.GetData("ADVALUE")))
      
      'get a system value specified at appdomainsetup
      Console.WriteLine("System value for loader optimization: {0}", _
         currentDomain.GetData("LOADER_OPTIMIZATION"))

   End Sub 
End Class 

' This code example produces the following output:
'
'ADVALUE is: Example value
'System value for loader optimization: NotSpecified

설명

이 메서드를 사용하여 이 AppDomaininstance 속성을 설명하는 이름-데이터 쌍의 내부 캐시에서 항목 값을 검색합니다. 의 와 키-값 쌍의 이름을 비교 name 하는 것은 대/소문자를 구분합니다.

캐시는 자동으로 애플리케이션 도메인이 만들어질 때 삽입 되는 미리 정의 된 시스템 항목을 포함 합니다. 메서드 또는 해당 AppDomainSetup 속성을 사용하여 GetData 해당 값을 검사할 수 있습니다.

메서드를 사용하여 사용자 정의 이름 데이터 쌍을 SetData 삽입하거나 수정하고 메서드를 사용하여 해당 값을 GetData 검사할 수 있습니다.

다음 표에서는 name 미리 정의된 각 시스템 항목 및 해당 AppDomainSetup 속성의 를 설명합니다.

'name' 값 속성
"APPBASE" AppDomainSetup.ApplicationBase
"APP_CONFIG_FILE" AppDomainSetup.ConfigurationFile
"APP_LAUNCH_URL" (속성 없음)

"APP_LAUNCH_URL"은 리디렉션 전에 사용자가 원래 요청한 URL을 나타냅니다. 브라우저에서 애플리케이션을 시작한 경우에만 사용할 수 있습니다. 모든 브라우저에서 이 값을 제공하는 것은 아닙니다.
"APP_NAME" AppDomainSetup.ApplicationName
"BINPATH_PROBE_ONLY" AppDomainSetup.PrivateBinPathProbe
"CACHE_BASE" AppDomainSetup.CachePath
"CODE_DOWNLOAD_DISABLED" AppDomainSetup.DisallowCodeDownload
"DEV_PATH" (속성 없음)
"DISALLOW_APP" AppDomainSetup.DisallowPublisherPolicy
"DISALLOW_APP_BASE_PROBING" AppDomainSetup.DisallowApplicationBaseProbing
"DISALLOW_APP_REDIRECTS" AppDomainSetup.DisallowBindingRedirects
"DYNAMIC_BASE" AppDomainSetup.DynamicBase
"FORCE_CACHE_INSTALL" AppDomainSetup.ShadowCopyFiles
"LICENSE_FILE" 또는 애플리케이션별 문자열 AppDomainSetup.LicenseFile
"LOADER_OPTIMIZATION" AppDomainSetup.LoaderOptimization
"LOCATION_URI" (속성 없음)
"PRIVATE_BINPATH" AppDomainSetup.PrivateBinPath
"REGEX_DEFAULT_MATCH_TIMEOUT" Regex.MatchTimeout

"REGEX_DEFAULT_MATCH_TIMEOUT"은 시스템 항목이 아니며 메서드를 호출 SetData 하여 해당 값을 설정할 수 있습니다.
"SHADOW_COPY_DIRS" AppDomainSetup.ShadowCopyDirectories

적용 대상

추가 정보