SwitchLevelAttribute.SwitchLevelType Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan atau mengatur jenis yang menentukan apakah jejak harus ditulis.
public:
property Type ^ SwitchLevelType { Type ^ get(); void set(Type ^ value); };
public Type SwitchLevelType { get; set; }
member this.SwitchLevelType : Type with get, set
Public Property SwitchLevelType As Type
Nilai Properti
Type yang menentukan apakah jejak harus ditulis.
Pengecualian
Operasi set gagal karena nilainya adalah null
.
Contoh
Contoh kode berikut menampilkan nilai SwitchLevelType properti untuk BooleanSwitch.
// Display the SwitchLevelAttribute for the BooleanSwitch.
Object[] attribs = typeof(BooleanSwitch).GetCustomAttributes(typeof(SwitchLevelAttribute), false);
if (attribs.Length == 0)
Console.WriteLine("Error, couldn't find SwitchLevelAttribute on BooleanSwitch.");
else
Console.WriteLine(((SwitchLevelAttribute)attribs[0]).SwitchLevelType.ToString());
' Display the SwitchLevelAttribute for the BooleanSwitch.
Dim attribs As [Object]() = GetType(BooleanSwitch).GetCustomAttributes(GetType(SwitchLevelAttribute), False)
If attribs.Length = 0 Then
Console.WriteLine("Error, couldn't find SwitchLevelAttribute on BooleanSwitch.")
Else
Console.WriteLine(CType(attribs(0), SwitchLevelAttribute).SwitchLevelType.ToString())
End If
Keterangan
Properti tingkat sakelar belum tentu dinamai Level
; misalnya, properti BooleanSwitch tingkat kelas adalah Enabled.
Berlaku untuk
Saran dan Komentar
https://aka.ms/ContentUserFeedback.
Segera hadir: Sepanjang tahun 2024 kami akan menghentikan penggunaan GitHub Issues sebagai mekanisme umpan balik untuk konten dan menggantinya dengan sistem umpan balik baru. Untuk mengetahui informasi selengkapnya, lihat:Kirim dan lihat umpan balik untuk