İngilizce dilinde oku

Aracılığıyla paylaş


RegistryValueOptions Sabit listesi

Tanım

Kayıt defteri anahtarından ad/değer çiftleri alınırken isteğe bağlı davranışı belirtir.

Bu sabit listesi, üyeleri için bit düzeyinde karşılaştırmayı destekler.

C#
[System.Flags]
public enum RegistryValueOptions
Devralma
RegistryValueOptions
Öznitelikler

Alanlar

Name Değer Description
DoNotExpandEnvironmentNames 1

Türün ExpandString değeri, eklenmiş ortam değişkenleri genişletilmeden alınır.

None 0

İsteğe bağlı davranış belirtilmedi.

Örnekler

Aşağıdaki kod örneği bir test anahtarı oluşturur, katıştırılmış ortam değişkeniyle bir değer ekler ve değeri hem genişletilmiş hem de genişletilmemiş formlarda alır.

C#
using System;
using Microsoft.Win32;
using Microsoft.VisualBasic;

public class Example
{
    public static void Main()
    {
        // Delete and recreate the test key.
        Registry.CurrentUser.DeleteSubKey("RegistryValueOptionsExample", false);
        RegistryKey rk =
            Registry.CurrentUser.CreateSubKey("RegistryValueOptionsExample");

        // Add a value that contains an environment variable.
        rk.SetValue("ExpandValue", "The path is %PATH%", RegistryValueKind.ExpandString);

        // Retrieve the value, first without expanding the environment
        // variable and then expanding it.
        Console.WriteLine("Unexpanded: \"{0}\"",
            rk.GetValue("ExpandValue", "No Value",
            RegistryValueOptions.DoNotExpandEnvironmentNames));
        Console.WriteLine("Expanded: \"{0}\"", rk.GetValue("ExpandValue"));
    } //Main
} //Example

Açıklamalar

Yöntem aşırı yüklemesi ile DoNotExpandEnvironmentNames bayrağını RegistryKey.GetValue(String, Object, RegistryValueOptions) kullanın.

Şunlara uygulanır

Ürün Sürümler
.NET Core 1.0, Core 1.1, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5