.NET undocumented (1) SimpleBitVector Struct

xiaoxiao2021-03-06  102

.NET Framework is profound and profound, this series is designed to excavate some .NET internal classes and some unpublished classes, thereby integrate experience in design and even Framework design. The author is mainly engaged in ASP.NET C # work, but puts energy in System.Web Namespace, this article is a by-product and preparatory knowledge of the Control class.

SIMPLEBITVECTOR32 structure

32-bit bit flag

Instructions:

SIMPLEBITVECTOR32 SBV? = New SimpleBitVector32 ();

/ / Judgment whether the nth is true

INT n = 7;

IF (SBV [Math.Power (2, N)])

{

.

.

.

}

Set the nth;

INT n = 7;

SBV [Math.Pow (2, N)] = true;

?

SimpleBitVector32 structure implementation:

Struct SimpleBitVector32 {??? private int data; ??? public int data ??? {??????? get ??????????? RETURN DATA ???????} ???} ??? public bool this [int bit] ??? {??????? Get ??????? {???????? ??? Return (Data & Bit) == bit); ??????????????? {??????????? f (Value) ??????????? {??????????????????????????????????????????????? ?? Return; ????????????????????????????????????????????????????}}

转载请注明原文地址:https://www.9cbs.com/read-123701.html

New Post(0)