AppDomain.SetData 메서드

정의

애플리케이션 도메인 속성에 값을 할당합니다.

오버로드

SetData(String, Object)

지정한 애플리케이션 도메인 속성에 지정한 값을 할당합니다.

SetData(String, Object, IPermission)

속성을 검색할 때 호출자의 요청에 대해 지정된 권한을 사용하여 지정한 애플리케이션 도메인 속성에 지정한 값을 할당합니다.

SetData(String, Object)

지정한 애플리케이션 도메인 속성에 지정한 값을 할당합니다.

public:
 void SetData(System::String ^ name, System::Object ^ data);
public:
 virtual void SetData(System::String ^ name, System::Object ^ data);
public void SetData (string name, object? data);
public void SetData (string name, object data);
[System.Security.SecurityCritical]
public void SetData (string name, object data);
member this.SetData : string * obj -> unit
abstract member SetData : string * obj -> unit
override this.SetData : string * obj -> unit
[<System.Security.SecurityCritical>]
abstract member SetData : string * obj -> unit
override this.SetData : string * obj -> unit
Public Sub SetData (name As String, data As Object)

매개 변수

name
String

만들거나 변경할 사용자 정의 애플리케이션 도메인 속성의 이름입니다.

data
Object

속성 값입니다.

구현

특성

예외

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

예제

다음 예제에서는 메서드를 사용하여 SetData(String, Object) 새 값 쌍을 만드는 방법을 보여 줍니다. 그런 다음, 메서드를 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

설명

이 메서드를 사용하여 항목을 삽입하거나 이 인스턴스의 속성을 설명하는 이름-데이터 쌍의 내부 캐시에 있는 항목 값을 AppDomain수정합니다.

캐시는 자동으로 애플리케이션 도메인이 만들어질 때 삽입 되는 미리 정의 된 시스템 항목을 포함 합니다. 이 메서드를 사용하여 시스템 항목을 삽입하거나 수정할 수 없습니다. 시스템 항목을 수정하려고 하는 메서드 호출은 영향을 주지 않습니다. 메서드가 예외를 throw하지 않습니다. 메서드 또는 에 설명된 해당 속성을 사용하여 GetData 시스템 항목의 값을 검사할 수 있습니다GetData.AppDomainSetup

이 메서드를 호출하여 인수의 값으로 "REGEX_DEFAULT_MATCH_TIMEOUT"를 제공하고 시간 제한 간격을 인수 TimeSpan 값으로 나타내는 값 name 으로 제공하여 정규식 패턴을 계산하기 위한 기본 제한 시간 간격의 data 값을 설정할 수 있습니다. 이 메서드를 사용하여 사용자 정의 이름 데이터 쌍을 삽입하거나 수정하고 메서드를 사용하여 해당 값을 GetData 검사할 수도 있습니다.

추가 정보

적용 대상

SetData(String, Object, IPermission)

속성을 검색할 때 호출자의 요청에 대해 지정된 권한을 사용하여 지정한 애플리케이션 도메인 속성에 지정한 값을 할당합니다.

public:
 void SetData(System::String ^ name, System::Object ^ data, System::Security::IPermission ^ permission);
public void SetData (string name, object data, System.Security.IPermission permission);
[System.Security.SecurityCritical]
public void SetData (string name, object data, System.Security.IPermission permission);
member this.SetData : string * obj * System.Security.IPermission -> unit
[<System.Security.SecurityCritical>]
member this.SetData : string * obj * System.Security.IPermission -> unit
Public Sub SetData (name As String, data As Object, permission As IPermission)

매개 변수

name
String

만들거나 변경할 사용자 정의 애플리케이션 도메인 속성의 이름입니다.

data
Object

속성 값입니다.

permission
IPermission

속성을 검색할 때 호출자의 요청에 대한 권한입니다.

특성

예외

name이(가) null인 경우

name이 시스템 정의 속성 문자열을 지정하고 permission 값이 null이 아닌 경우

설명

이 메서드를 사용 하 여를 삽입 하거나 애플리케이션 도메인의 속성을 설명 하는 이름/데이터 쌍의 내부 캐시에 고유한 사용자 정의 항목을 수정 합니다. 항목을 삽입할 때 항목을 검색할 때 적용할 사용 권한 요구를 지정할 수 있습니다. 또한 이 메서드를 호출하여 인수의 값으로 "REGEX_DEFAULT_MATCH_TIMEOUT"를 제공하고 시간 제한 간격을 인수 TimeSpan 값으로 나타내는 값 name 으로 제공하여 정규식 패턴을 계산하기 위한 기본 시간 제한 간격의 data 값을 설정할 수 있습니다.

이 메서드를 사용하여 시스템 정의 속성 문자열에 보안 요구를 할당할 수 없습니다.

캐시는 자동으로 애플리케이션 도메인이 만들어질 때 삽입 되는 미리 정의 된 시스템 항목을 포함 합니다. 이 메서드를 사용하여 시스템 항목을 삽입하거나 수정할 수 없습니다. 시스템 항목을 수정하려고 하는 메서드 호출은 영향을 주지 않습니다. 메서드가 예외를 throw하지 않습니다. 메서드 또는 메서드에 대한 GetData 주의 섹션에 GetData 설명된 해당 AppDomainSetup 속성을 사용하여 시스템 항목의 값을 검사할 수 있습니다.

적용 대상