Table of Contents

Class XShort

Extension methods for short.

Inheritance
System.Object
XShort
Namespace: Galaxon.Core.Numbers
Assembly: Galaxon.Core.dll
Syntax
public static class XShort : object

Methods

Abs(Int16)

Return the absolute value of a short as a ushort. This addresses an issue with short.Abs(), which is that Abs(short.MinValue) can't be expressed as a short, and so wrap-around occurs. Unsigned integer types don't have an Abs() method, so there's no collision.

Declaration
public static ushort Abs(short n)
Parameters
Type Name Description
System.Int16 n

A short value.

Returns
Type Description
System.UInt16

The absolute value as a ushort.

| Improve this Doc View Source

GetRandom()

Get a random short.

Declaration
public static short GetRandom()
Returns
Type Description
System.Int16
| Improve this Doc View Source
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX | Galaxy logo by Freepik