Show / Hide Table of Contents

Class LongExtensions

Useful extension methods for System.Int64.

Inheritance
Object
LongExtensions
Inherited Members
System.Object.ToString()
Object.Equals(Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
Object.MemberwiseClone()
Namespace: IRM
Assembly: IRM.dll
Syntax
public static class LongExtensions

Methods

AddCheckNumber(Int64)

Calculates the check number according to the Luhn algoritm and adds it to the end.

Declaration
public static long AddCheckNumber(this long number)
Parameters
System.Int64 number

The System.Int64 to calculate and add check number for.

Returns
System.Int64

The original number with the check number added to the end.

FromUnixTimestamp(Int64)

Returns a DateTime (DateTimeKind.Utc) converted from a Unix timestamp.

Declaration
public static DateTime FromUnixTimestamp(this long unixTimestamp)
Parameters
System.Int64 unixTimestamp

The number of seconds that have elapsed since 00:00:00 UTC Thursday, 1 January 1970..

Returns
System.DateTime

The unixTimestamp to convert to DateTime (DateTimeKund.Utc).

IsLuhn(Int64)

Gets if a string is valid according to the Luhn algoritm, for example a social security number.

Declaration
public static bool IsLuhn(this long number)
Parameters
System.Int64 number

The System.Int64 to check if it is valid according to the Luhn aloritm.

Returns
Boolean

true if the string is valid according to the Luhn algoritm; otherwise false.

Back to top Generated by DocFX