CodeTypeMember.Attributes 屬性


取得或設定成員的屬性 (Attribute)。Gets or sets the attributes of the member.

 property System::CodeDom::MemberAttributes Attributes { System::CodeDom::MemberAttributes get(); void set(System::CodeDom::MemberAttributes value); };
public System.CodeDom.MemberAttributes Attributes { get; set; }
member this.Attributes : System.CodeDom.MemberAttributes with get, set
Public Property Attributes As MemberAttributes


MemberAttributes 值的位元組合,用來指示成員的屬性。A bitwise combination of the MemberAttributes values used to indicate the attributes of the member. 預設值是Private。 | FinalThe default value is Private | Final.


這個屬性是用來指定類型成員的屬性。This property is used to specify the attributes of the type member.

成員屬性是以群組分類, 每個群組都有遮罩。Member attributes are classified in groups, with a mask for each group. 存取群組是由包含Public詞彙、 PrivateFamilyAssembly的旗標所組成。The access group consists of flags containing the terms Public, Private, Family, or Assembly. 範圍群組Abstract包含、 FinalStaticOverrideConst的旗標。The scope group includes flags for Abstract, Final, Static, Override, and Const. AccessMask遮罩會識別存取屬性。The AccessMask mask identifies the access attributes. ScopeMask遮罩會識別範圍屬性。The ScopeMask mask identifies the scope attributes. Attributes屬性的預設值包含存取和範圍的旗標。The default value for the Attributes property includes flags from both access and scope. 若要變更存取或範圍, 請先遮蔽現有的旗標, 然後設定新的值。To change either access or scope, first mask out the existing flags and then set the new value. 例如, 用來識別公用程式 (名constructor1為) 的程式碼語句是。 constructor1.Attributes = (constructor1.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public;For example, the code statement to identify a constructor (named constructor1) as public is constructor1.Attributes = (constructor1.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public;.