Class Int16Ex
Class containing some extension methods for System.Int16.
Inheritance
Inherited Members
Namespace:Extend
Assembly:Extend.dll
Syntax
public static class Int16Ex
Methods
| Improve this Doc View SourceApril(Int16, Int16)
Returns a date-time representing the specified day in April in the specified year.
Declaration
public static DateTime April(this short day, short year)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | day | The day. |
System.Int16 | year | The year. |
Returns
Type | Description |
---|---|
System.DateTime | Return a date-time representing the specified day in April in the specified year. |
August(Int16, Int16)
Returns a date-time representing the specified day in August in the specified year.
Declaration
public static DateTime August(this short day, short year)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | day | The day. |
System.Int16 | year | The year. |
Returns
Type | Description |
---|---|
System.DateTime | Return a date-time representing the specified day in August in the specified year. |
DaysInMonth(Int16, Int16)
Returns the number of days in the specified month of the specified year.
Declaration
public static int DaysInMonth(this short year, short month)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | year | The year. |
System.Int16 | month | The month. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the number of days of the specified month. For example February (2), the return value is 28 or 29 depending upon whether is a leap year. |
December(Int16, Int16)
Returns a date-time representing the specified day in December in the specified year.
Declaration
public static DateTime December(this short day, short year)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | day | The day. |
System.Int16 | year | The year. |
Returns
Type | Description |
---|---|
System.DateTime | Return a date-time representing the specified day in December in the specified year. |
FactorOf(Int16, Int16)
Checks if the Int16 value is a factor of the specified factor number.
Declaration
public static bool FactorOf(this short value, short factorNumer)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | value | The Int16 value to check. |
System.Int16 | factorNumer | The factor number. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the value is a factor of the specified factor number, otherwise false. |
Exceptions
Type | Condition |
---|---|
System.DivideByZeroException | value is 0. |
February(Int16, Int16)
Returns a date-time representing the specified day in February in the specified year.
Declaration
public static DateTime February(this short day, short year)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | day | The day. |
System.Int16 | year | The year. |
Returns
Type | Description |
---|---|
System.DateTime | Return a date-time representing the specified day in February in the specified year. |
IsEven(Int16)
Checks if the Int16 is even.
Declaration
public static bool IsEven(this short value)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | value | The Int16 to check. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the Int16 is even, otherwise false. |
IsLeapYear(Int16)
Returns whether the given year is a leap year or not.
Declaration
public static bool IsLeapYear(this short year)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | year | The year. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the year is a leap year, otherwise false. |
IsMultipleOf(Int16, Int16)
Checks if the Int16 value is a multiple of the given factor.
Declaration
public static bool IsMultipleOf(this short value, short factor)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | value | The Int16 to check. |
System.Int16 | factor | The factor. |
Returns
Type | Description |
---|---|
System.Boolean | >Returns true if the Int16 value is a multiple of the given factor. |
Exceptions
Type | Condition |
---|---|
System.DivideByZeroException | factor is 0. |
IsOdd(Int16)
Checks if the Int16 is odd.
Declaration
public static bool IsOdd(this short value)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | value | The Int16 to check. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the Int16 is odd, otherwise false. |
January(Int16, Int16)
Returns a date-time representing the specified day in January in the specified year.
Declaration
public static DateTime January(this short day, short year)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | day | The day. |
System.Int16 | year | The year. |
Returns
Type | Description |
---|---|
System.DateTime | Return a date-time representing the specified day in January in the specified year. |
July(Int16, Int16)
Returns a date-time representing the specified day in July in the specified year.
Declaration
public static DateTime July(this short day, short year)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | day | The day. |
System.Int16 | year | The year. |
Returns
Type | Description |
---|---|
System.DateTime | Return a date-time representing the specified day in July in the specified year. |
June(Int16, Int16)
Returns a date-time representing the specified day in June in the specified year.
Declaration
public static DateTime June(this short day, short year)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | day | The day. |
System.Int16 | year | The year. |
Returns
Type | Description |
---|---|
System.DateTime | Return a date-time representing the specified day in June in the specified year. |
March(Int16, Int16)
Returns a date-time representing the specified day in March in the specified year.
Declaration
public static DateTime March(this short day, short year)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | day | The day. |
System.Int16 | year | The year. |
Returns
Type | Description |
---|---|
System.DateTime | Return a date-time representing the specified day in March in the specified year. |
May(Int16, Int16)
Returns a date-time representing the specified day in May in the specified year.
Declaration
public static DateTime May(this short day, short year)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | day | The day. |
System.Int16 | year | The year. |
Returns
Type | Description |
---|---|
System.DateTime | Return a date-time representing the specified day in May in the specified year. |
November(Int16, Int16)
Returns a date-time representing the specified day in November in the specified year.
Declaration
public static DateTime November(this short day, short year)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | day | The day. |
System.Int16 | year | The year. |
Returns
Type | Description |
---|---|
System.DateTime | Return a date-time representing the specified day in November in the specified year. |
October(Int16, Int16)
Returns a date-time representing the specified day in October in the specified year.
Declaration
public static DateTime October(this short day, short year)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | day | The day. |
System.Int16 | year | The year. |
Returns
Type | Description |
---|---|
System.DateTime | Return a date-time representing the specified day in October in the specified year. |
PercentageOf(Int16, Decimal)
Gets the specified percentage of the number.
Declaration
public static decimal PercentageOf(this short number, decimal percent)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | number | The number. |
System.Decimal | percent | The percent. |
Returns
Type | Description |
---|---|
System.Decimal | Returns the specified percentage of the number |
PercentageOf(Int16, Double)
Gets the specified percentage of the number.
Declaration
public static double PercentageOf(this short number, double percent)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | number | The number. |
System.Double | percent | The percent. |
Returns
Type | Description |
---|---|
System.Double | Returns the specified percentage of the number |
PercentageOf(Int16, Int32)
Gets the specified percentage of the number.
Declaration
public static double PercentageOf(this short number, int percent)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | number | The number. |
System.Int32 | percent | The percent. |
Returns
Type | Description |
---|---|
System.Double | Returns the specified percentage of the number |
PercentageOf(Int16, Int64)
Gets the specified percentage of the number.
Declaration
public static double PercentageOf(this short number, long percent)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | number | The number. |
System.Int64 | percent | The percent. |
Returns
Type | Description |
---|---|
System.Double | Returns the specified percentage of the number |
PercentOf(Int16, Double)
Gets the percentage of the number.
Declaration
public static double PercentOf(this short number, double total)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | number | The number. |
System.Double | total | The total value. |
Returns
Type | Description |
---|---|
System.Double | Returns the percentage of the number. |
Exceptions
Type | Condition |
---|---|
System.DivideByZeroException | The number must be greater than zero. |
PercentOf(Int16, Int32)
Gets the percentage of the number.
Declaration
public static double PercentOf(this short number, int total)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | number | The number. |
System.Int32 | total | The total value. |
Returns
Type | Description |
---|---|
System.Double | Returns the percentage of the number. |
Exceptions
Type | Condition |
---|---|
System.DivideByZeroException | The number must be greater than zero. |
PercentOf(Int16, Int64)
Gets the percentage of the number.
Declaration
public static double PercentOf(this short number, long total)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | number | The number. |
System.Int64 | total | The total value. |
Returns
Type | Description |
---|---|
System.Double | Returns the percentage of the number. |
Exceptions
Type | Condition |
---|---|
System.DivideByZeroException | The number must be greater than zero. |
RangeTo(Int16, Int16)
Returns a list containing all values of the given range.
Declaration
public static List<short> RangeTo(this short startValue, short endValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | startValue | The start of the range. |
System.Int16 | endValue | The end of the range. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<T><System.Int16> | Returns a list containing the specified range. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | The start value can not be greater than the end value. |
September(Int16, Int16)
Returns a date-time representing the specified day in September in the specified year.
Declaration
public static DateTime September(this short day, short year)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | day | The day. |
System.Int16 | year | The year. |
Returns
Type | Description |
---|---|
System.DateTime | Return a date-time representing the specified day in September in the specified year. |
ToDays(Int16)
Returns a System.TimeSpan that represents a specified number of days, where the specification is accurate to the nearest millisecond.
Declaration
public static TimeSpan ToDays(this short value)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | value | A number of days. |
Returns
Type | Description |
---|---|
System.TimeSpan | Returns a System.TimeSpan representing the given value. |
Exceptions
Type | Condition |
---|---|
System.OverflowException | value is less than System.TimeSpan.MinValue or greater than System.TimeSpan.MaxValue. |
ToHours(Int16)
Returns a System.TimeSpan that represents a specified number of hours, where the specification is accurate to the nearest millisecond.
Declaration
public static TimeSpan ToHours(this short value)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | value | A number of hours. |
Returns
Type | Description |
---|---|
System.TimeSpan | Returns a System.TimeSpan representing the given value. |
Exceptions
Type | Condition |
---|---|
System.OverflowException | value is less than System.TimeSpan.MinValue or greater than System.TimeSpan.MaxValue. |
ToMilliseconds(Int16)
Returns a System.TimeSpan that represents a specified number of milliseconds, where the specification is accurate to the nearest millisecond.
Declaration
public static TimeSpan ToMilliseconds(this short value)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | value | A number of milliseconds. |
Returns
Type | Description |
---|---|
System.TimeSpan | Returns a System.TimeSpan representing the given value. |
Exceptions
Type | Condition |
---|---|
System.OverflowException | value is less than System.TimeSpan.MinValue or greater than System.TimeSpan.MaxValue. |
ToMinutes(Int16)
Returns a System.TimeSpan that represents a specified number of minutes, where the specification is accurate to the nearest millisecond.
Declaration
public static TimeSpan ToMinutes(this short value)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | value | A number of minutes. |
Returns
Type | Description |
---|---|
System.TimeSpan | Returns a System.TimeSpan representing the given value. |
Exceptions
Type | Condition |
---|---|
System.OverflowException | value is less than System.TimeSpan.MinValue or greater than System.TimeSpan.MaxValue. |
ToSeconds(Int16)
Returns a System.TimeSpan that represents a specified number of seconds, where the specification is accurate to the nearest millisecond.
Declaration
public static TimeSpan ToSeconds(this short value)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | value | A number of seconds. |
Returns
Type | Description |
---|---|
System.TimeSpan | Returns a System.TimeSpan representing the given value. |
Exceptions
Type | Condition |
---|---|
System.OverflowException | value is less than System.TimeSpan.MinValue or greater than System.TimeSpan.MaxValue. |