Skip to content

M_Cyjb_UInt32Util_IsPowerOf2

CYJB edited this page Mar 20, 2024 · 13 revisions

UInt32Util.IsPowerOf2 方法

判断指定 UInt32 是否是 2 的幂。

Namespace: Cyjb
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6

语法

C#

public static bool IsPowerOf2(
	this uint value
)

参数

 

value
Type: System.UInt32
要判断是否是 2 的幂的 UInt32

返回值

Type: Boolean
如果果 value2 的幂,则为 true;否则为 false

备注

在 Visual Basic 和 C# 中,这个方法可以当成为类型UInt32的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考 扩展方法 (Visual Basic)扩展方法 (C# 编程指南) 获取更多信息。

Remarks

对于 0,结果为 false

参见

Reference

UInt32Util 类
Cyjb 命名空间

Clone this wiki locally