AppDomain.GetData(String) Yöntem

Tanım

Belirtilen ad için geçerli uygulama etki alanında depolanan değeri alır.

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

Parametreler

name
String

Önceden tanımlanmış bir uygulama etki alanı özelliğinin adı veya tanımladığınız bir uygulama etki alanı özelliğinin adı.

Döndürülenler

özelliğinin name değeri veya null özelliğin mevcut olmaması.

Uygulamalar

Özel durumlar

name, null değeridir.

İşlem, yüklenmemiş bir uygulama etki alanında deneniyor.

Örnekler

Aşağıdaki örnek yeni bir uygulama etki alanı oluşturur, etki alanı için sistem tarafından sağlanan bir değer ayarlar ve etki alanı için yeni bir değer çifti ekler. Örnek daha sonra bu değer çiftlerinden verileri almak ve konsolda görüntülemek için yönteminin nasıl kullanılacağını GetData gösterir.

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

Açıklamalar

bu örneğinin AppDomainözelliklerini açıklayan ad-veri çiftlerinin iç önbelleğindeki bir girdinin değerini almak için bu yöntemi kullanın. değerinin anahtar-değer çiftlerinin adıyla karşılaştırılmasının name büyük/küçük harfe duyarlı olduğunu unutmayın.

Önbellek, uygulama etki alanı oluşturulduğunda eklenen önceden tanımlanmış sistem girdilerini otomatik olarak içerir. Yöntemini veya eşdeğer AppDomainSetup özelliklerini kullanarak GetData değerlerini inceleyebilirsiniz.

yöntemiyle SetData kendi kullanıcı tanımlı ad-veri çiftlerinizi ekleyebilir veya değiştirebilir ve değerlerini yöntemiyle GetData inceleyebilirsiniz.

Aşağıdaki tabloda, önceden tanımlanmış her sistem girişinin ve buna karşılık gelen AppDomainSetup özelliği açıklanmaktadırname.

'name' değeri Özellik
"APPBASE" AppDomainSetup.ApplicationBase
"APP_CONFIG_FILE" AppDomainSetup.ConfigurationFile
"APP_LAUNCH_URL" (özellik yok)

"APP_LAUNCH_URL", herhangi bir yeniden yönlendirmeden önce kullanıcı tarafından istenen URL'yi temsil eder. Yalnızca uygulama bir tarayıcıyla başlatıldığında kullanılabilir. Tüm tarayıcılar bu değeri sağlamaz.
"APP_NAME" AppDomainSetup.ApplicationName
"BINPATH_PROBE_ONLY" AppDomainSetup.PrivateBinPathProbe
"CACHE_BASE" AppDomainSetup.CachePath
"CODE_DOWNLOAD_DISABLED" AppDomainSetup.DisallowCodeDownload
"DEV_PATH" (özellik yok)
"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" veya uygulamaya özgü bir dize AppDomainSetup.LicenseFile
"LOADER_OPTIMIZATION" AppDomainSetup.LoaderOptimization
"LOCATION_URI" (özellik yok)
"PRIVATE_BINPATH" AppDomainSetup.PrivateBinPath
"REGEX_DEFAULT_MATCH_TIMEOUT" Regex.MatchTimeout

"REGEX_DEFAULT_MATCH_TIMEOUT" bir sistem girişi değildir ve değeri yöntemi çağrılarak SetData ayarlanabilir.
"SHADOW_COPY_DIRS" AppDomainSetup.ShadowCopyDirectories

Şunlara uygulanır

Ayrıca bkz.