AppDomain.SetData 메서드

정의

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

오버로드

Name Description
SetData(String, Object)

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

SetData(String, Object, IPermission)

지정된 값을 지정된 애플리케이션 도메인 속성에 할당하고, 속성을 검색할 때 호출자를 요청할 수 있는 지정된 권한을 부여합니다.

SetData(String, Object)

Source:
AppDomain.cs
Source:
AppDomain.cs
Source:
AppDomain.cs
Source:
AppDomain.cs
Source:
AppDomain.cs

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

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 시스템 항목의 값을 검사할 수 있습니다AppDomainSetup.GetData

이 메서드를 호출하여 "REGEX_DEFAULT_MATCH_TIMEOUT"을 인수의 값으로 제공하고 시간 제한 간격을 인수 nameTimeSpan 으로 나타내는 값을 제공하여 정규식 패턴을 평가하기 위한 기본 시간 제한 간격의 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

속성을 검색할 때 호출자를 요청할 수 있는 권한입니다.

특성

예외

namenull입니다.

name 는 시스템 정의 속성 문자열을 지정하며 permissionnull.

설명

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

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

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

적용 대상