BitVector32.Item[] 属性

定义

获取或设置指定节或位标志的值。Gets or sets the value of the specified section or bit flag.

重载

Item[BitVector32+Section]

获取或设置存储在指定 BitVector32.Section 中的值。Gets or sets the value stored in the specified BitVector32.Section.

Item[Int32]

获取或设置由指定屏蔽指示的位标志的状态。Gets or sets the state of the bit flag indicated by the specified mask.

Item[BitVector32+Section]

获取或设置存储在指定 BitVector32.Section 中的值。Gets or sets the value stored in the specified BitVector32.Section.

public:
 property int default[System::Collections::Specialized::BitVector32::Section] { int get(System::Collections::Specialized::BitVector32::Section section); void set(System::Collections::Specialized::BitVector32::Section section, int value); };
public int this[System.Collections.Specialized.BitVector32.Section section] { get; set; }
member this.Item(System.Collections.Specialized.BitVector32.Section) : int with get, set
Default Public Property Item(section As BitVector32.Section) As Integer

参数

section
BitVector32.Section

一个 BitVector32.Section,它包含要获取或设置的值。A BitVector32.Section that contains the value to get or set.

属性值

Int32

存储在指定 BitVector32.Section 中的值。The value stored in the specified BitVector32.Section.

注解

" Item[] [节]" 属性是设置为 "部分" 的的索引器 BitVector32 ,而 " Item[] [int]" 属性是 BitVector32 设置为位标志的的索引器。The Item[] [Section] property is the indexer for a BitVector32 that is set up as sections, and the Item[] [int] property is the indexer for a BitVector32 that is set up as bit flags.

BitVector32.Section是中的一个窗口,它由 BitVector32 可以包含中指定的最大值的连续最小位数组成 CreateSectionA BitVector32.Section is a window into the BitVector32 and is composed of the smallest number of consecutive bits that can contain the maximum value specified in CreateSection. 例如,最大值为1的节仅由一位构成,而最大值为5的节由三位组成。For example, a section with a maximum value of 1 is composed of only one bit, whereas a section with a maximum value of 5 is composed of three bits. 你可以创建一个 BitVector32.Section 最大值为1的,以用作布尔值,从而允许你在同一中存储整数和布尔值 BitVector32You can create a BitVector32.Section with a maximum value of 1 to serve as a Boolean, thereby allowing you to store integers and Booleans in the same BitVector32.

C # 语言使用 this 关键字来定义索引器,而不是实现 Item[] 属性。The C# language uses the this keyword to define the indexers instead of implementing the Item[] property. Visual Basic 实现 Item[]默认属性,该属性提供相同的索引功能。Visual Basic implements Item[] as a default property, which provides the same indexing functionality.

检索此属性的值是一个 O (1) 操作;设置属性也是 O (1) 操作。Retrieving the value of this property is an O(1) operation; setting the property is also an O(1) operation.

另请参阅

适用于

Item[Int32]

获取或设置由指定屏蔽指示的位标志的状态。Gets or sets the state of the bit flag indicated by the specified mask.

public:
 property bool default[int] { bool get(int bit); void set(int bit, bool value); };
public bool this[int bit] { get; set; }
member this.Item(int) : bool with get, set
Default Public Property Item(bit As Integer) As Boolean

参数

bit
Int32

一个屏蔽,它指示要获取或设置的位。A mask that indicates the bit to get or set.

属性值

Boolean

如果指定位标志是“开”(1),则为 true;否则为 falsetrue if the specified bit flag is on (1); otherwise, false.

注解

" Item[] [节]" 属性是设置为 "部分" 的的索引器 BitVector32 ,而 " Item[] [int]" 属性是 BitVector32 设置为位标志的的索引器。The Item[] [Section] property is the indexer for a BitVector32 that is set up as sections, and the Item[] [int] property is the indexer for a BitVector32 that is set up as bit flags.

在设置为节的上使用此属性 BitVector32 可能会导致意外的结果。Using this property on a BitVector32 that is set up as sections might cause unexpected results.

C # 语言使用 this 关键字来定义索引器,而不是实现 Item[] 属性。The C# language uses the this keyword to define the indexers instead of implementing the Item[] property. Visual Basic 实现 Item[]默认属性,该属性提供相同的索引功能。Visual Basic implements Item[] as a default property, which provides the same indexing functionality.

检索此属性的值是一个 O (1) 操作;设置属性也是 O (1) 操作。Retrieving the value of this property is an O(1) operation; setting the property is also an O(1) operation.

另请参阅

适用于