C# 클래스 Utilities.Extensions.NumberExtensions

파일 보기 프로젝트 열기: feanz/Utilities

공개 메소드들

메소드 설명
Days ( this num ) : System.TimeSpan

Converts the number to days as a TimeSpan.

DaysAgo ( this days ) : System.DateTime

Returns a date in the past by given number of days.

DaysFromNow ( this days ) : System.DateTime

Returns a date in the future by days.

EnsurePositive ( this number ) : float

Ensures that the specified float is positive

EnsurePositive ( this number ) : int

Ensures that the specified integer is positive

ForceLength ( this number, int length ) : string

Convert integer to string with a minimum length padding with "0" if int is to short.

Hours ( this num ) : System.TimeSpan

Converts the number to hours as a TimeSpan

HoursAgo ( this hours ) : System.DateTime

Returns a date in the past by hours.

HoursFromNow ( this hours ) : System.DateTime

Returns a date in the future by hours.

IsEven ( this value ) : bool

Returns true if number is even

IsOdd ( this value ) : bool

Returns true if number is odd

Minutes ( this num ) : System.TimeSpan

Converts the number of minutes as a TimeSpan

MinutesAgo ( this minutes ) : System.DateTime

Returns a date in the past by minutes

MinutesFromNow ( this minutes ) : System.DateTime

Returns a date in the future by minutes.

Seconds ( this num ) : System.TimeSpan

Converts the number to seconds as a TimeSpan

SecondsAgo ( this seconds ) : System.DateTime

Gets a date in the past according to seconds

SecondsFromNow ( this seconds ) : System.DateTime

Gets a date in the future by seconds.

Time ( this num ) : System.TimeSpan

Converts the number to a TimeSpan.

Time ( this num, bool convertSingleDigitsToHours ) : System.TimeSpan

Converts the military time to a timespan.

ToBinary ( this number ) : string

Returns a binary string representation of the number.

ToHex ( this number ) : string

Returns a hexadecimal string representation of the number.

ToHexChar ( this nibble ) : int

Convert an nibble value(4 bit) integer to its corresponding hex value

ToStringCurrentCulture ( this instance ) : string

Returns a string representation using the Current culture

ToStringInvariantCulture ( this instance ) : string

Returns a string representation using an invariant culture

메소드 상세

Days() 공개 정적인 메소드

Converts the number to days as a TimeSpan.
public static Days ( this num ) : System.TimeSpan
num this Number representing days
리턴 System.TimeSpan

DaysAgo() 공개 정적인 메소드

Returns a date in the past by given number of days.
public static DaysAgo ( this days ) : System.DateTime
days this The days.
리턴 System.DateTime

DaysFromNow() 공개 정적인 메소드

Returns a date in the future by days.
public static DaysFromNow ( this days ) : System.DateTime
days this The days.
리턴 System.DateTime

EnsurePositive() 공개 정적인 메소드

Ensures that the specified float is positive
public static EnsurePositive ( this number ) : float
number this The float we are ensuring is positive
리턴 float

EnsurePositive() 공개 정적인 메소드

Ensures that the specified integer is positive
public static EnsurePositive ( this number ) : int
number this The integer we are ensuring is positive.
리턴 int

ForceLength() 공개 정적인 메소드

Convert integer to string with a minimum length padding with "0" if int is to short.
public static ForceLength ( this number, int length ) : string
number this The number we are coverting to a fixed string length.
length int The length to fix the integer to.
리턴 string

Hours() 공개 정적인 메소드

Converts the number to hours as a TimeSpan
public static Hours ( this num ) : System.TimeSpan
num this Number representing hours
리턴 System.TimeSpan

HoursAgo() 공개 정적인 메소드

Returns a date in the past by hours.
public static HoursAgo ( this hours ) : System.DateTime
hours this The hours.
리턴 System.DateTime

HoursFromNow() 공개 정적인 메소드

Returns a date in the future by hours.
public static HoursFromNow ( this hours ) : System.DateTime
hours this The hours.
리턴 System.DateTime

IsEven() 공개 정적인 메소드

Returns true if number is even
public static IsEven ( this value ) : bool
value this The value to check.
리턴 bool

IsOdd() 공개 정적인 메소드

Returns true if number is odd
public static IsOdd ( this value ) : bool
value this
리턴 bool

Minutes() 공개 정적인 메소드

Converts the number of minutes as a TimeSpan
public static Minutes ( this num ) : System.TimeSpan
num this Number representing minutes
리턴 System.TimeSpan

MinutesAgo() 공개 정적인 메소드

Returns a date in the past by minutes
public static MinutesAgo ( this minutes ) : System.DateTime
minutes this The minutes.
리턴 System.DateTime

MinutesFromNow() 공개 정적인 메소드

Returns a date in the future by minutes.
public static MinutesFromNow ( this minutes ) : System.DateTime
minutes this The minutes.
리턴 System.DateTime

Seconds() 공개 정적인 메소드

Converts the number to seconds as a TimeSpan
public static Seconds ( this num ) : System.TimeSpan
num this
리턴 System.TimeSpan

SecondsAgo() 공개 정적인 메소드

Gets a date in the past according to seconds
public static SecondsAgo ( this seconds ) : System.DateTime
seconds this The seconds.
리턴 System.DateTime

SecondsFromNow() 공개 정적인 메소드

Gets a date in the future by seconds.
public static SecondsFromNow ( this seconds ) : System.DateTime
seconds this The seconds.
리턴 System.DateTime

Time() 공개 정적인 메소드

Converts the number to a TimeSpan.
public static Time ( this num ) : System.TimeSpan
num this Number reprsenting a timespan
리턴 System.TimeSpan

Time() 공개 정적인 메소드

Converts the military time to a timespan.
public static Time ( this num, bool convertSingleDigitsToHours ) : System.TimeSpan
num this
convertSingleDigitsToHours bool Indicates whether to treat "9" as 9 hours instead of minutes.
리턴 System.TimeSpan

ToBinary() 공개 정적인 메소드

Returns a binary string representation of the number.
public static ToBinary ( this number ) : string
number this The integer number to convert.
리턴 string

ToHex() 공개 정적인 메소드

Returns a hexadecimal string representation of the number.
public static ToHex ( this number ) : string
number this The integer number to convert.
리턴 string

ToHexChar() 공개 정적인 메소드

Convert an nibble value(4 bit) integer to its corresponding hex value
public static ToHexChar ( this nibble ) : int
nibble this
리턴 int

ToStringCurrentCulture() 공개 정적인 메소드

Returns a string representation using the Current culture
public static ToStringCurrentCulture ( this instance ) : string
instance this
리턴 string

ToStringInvariantCulture() 공개 정적인 메소드

Returns a string representation using an invariant culture
public static ToStringInvariantCulture ( this instance ) : string
instance this
리턴 string