开发者

How to get range of data types in c#?

开发者 https://www.devze.com 2022-12-23 05:33 出处:网络
How to get range of data types in c s开发者_Python百科harp .net ? For example if I wish to get range of uint datatype, how can I get it through code ?Please see this sample reference -->

How to get range of data types in c s开发者_Python百科harp .net ? For example if I wish to get range of uint datatype, how can I get it through code ?


Please see this sample reference -->

  • UInt64.MinValue Field - Represents the smallest possible value of UInt64. This field is constant. MSDN Link - http://msdn.microsoft.com/en-us/library/system.uint64.minvalue.aspx

  • UInt64.MaxValue Field - Represents the largest possible value of UInt64. This field is constant. MSDN Link - http://msdn.microsoft.com/en-us/library/system.uint64.maxvalue.aspx


No standard, sorry.

But they all implement IIRC MinValue and MaxValue, so you could use reflect to get those static items.


If I understand your question correctly, you can use:

uint.MinValue

and

uint.MaxValue


If you mean min/max values for numeric types they are usually defined as constants on that type. Eg.: int.MaxValue;

0

精彩评论

暂无评论...
验证码 换一张
取 消