SORU
4 AĞUSTOS 2011, PERŞEMBE


& = | =(tek boru eşit) ve(tek eşittir işareti) c ne anlama geliyor# (bulunan)

aşağıda satır :

//Folder.Attributes = FileAttributes.Directory | FileAttributes.Hidden | FileAttributes.System | FileAttributes.ReadOnly;
Folder.Attributes |= FileAttributes.Directory | FileAttributes.Hidden | FileAttributes.System | FileAttributes.ReadOnly;


Folder.Attributes |= ~FileAttributes.System;
Folder.Attributes &= ~FileAttributes.System;

|= (tek boru eşit) ve &= (tek eşittir işareti) c ne anlama geliyor#
Diğerleri tutarak, sistem özniteliğini kaldırmak istiyorum

şimdiden teşekkürler

CEVAP
4 AĞUSTOS 2011, PERŞEMBE


compound assignment onlar operatörleri, çeviri (çok gevşek)

x |= y;

içine

x = x | y;

ve & için aynı. Bazı durumlarda biraz daha fazla ayrıntı örtülü bir döküm ile ilgili var, ve hedef değişken yalnızca bir kez değerlendirilir ama aslında olayın özü bu.

Olmayan bileşik operatörler & is a bitwise "AND" | is a bitwise "OR" açısından.

EDİT: Folder.Attributes &= ~FileAttributes.System. istediğiniz bu durumda Nedenini anlamak için:

  • ~FileAttributes.System "tüm niteliklerini ifade ediyorhariçSystem" (~ bir bit DEĞİL)
  • & demek "sonucu işlenen her iki tarafta da meydana gelen tüm özelliklere sahiptir"

Temelde bir maske gibi davranıyor -sadecegörünen o öznitelikleri koru ("") her şey hariç Sistemi. Genel:

  • |= sadece hiçekleyinhedef bit
  • &= sadece hiçKaldırhedef bit

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Bad Lip Reading

    Bad Lip Read

    22 Mart 2011
  • Jon Reed

    Jon Reed

    14 AĞUSTOS 2006
  • Press Start

    Press Start

    4 HAZİRAN 2006