Convertion ClassNemiro.Convertion
Converts a data type to another data type.
Inheritance Hierarchy

System Object
  Nemiro Convertion

Namespace: Nemiro
Assembly: Nemiro.Convertion (in Nemiro.Convertion.dll) Version: 2.1.4.402 (2.1.4.402)
Syntax

public static class Convertion

The Convertion type exposes the following members.

Methods

  NameDescription
Public methodStatic memberFromBase16(String)
Converts the value in hexadecimal format to a 64-bit signed integer.
Public methodStatic memberFromBase16(String, String)
Converts the value in hexadecimal format to a 64-bit signed integer.
Public methodStatic memberFromBase36(String)
Converts the value in hexatrigesimal format to a 64-bit signed integer.
Public methodStatic memberFromBase36(String, String)
Converts the value in hexatrigesimal format to a 64-bit signed integer.
Public methodStatic memberFromBase62(String)
Converts the value in duosexagesimal format to a 64-bit signed integer.
Public methodStatic memberFromBase62(String, String)
Converts the value in duosexagesimal format to a 64-bit signed integer.
Public methodStatic memberFromBaseX
Converts the specified value from the specified system to decimal.
Public methodStatic memberToBase16(Int64)
Converts the value of the specified number to hexadecimal format.
Public methodStatic memberToBase16(Int64, String)
Converts the value of the specified number to hexadecimal format.
Public methodStatic memberToBase36(Int64)
Converts the value of the specified number to hexatrigesimal format.
Public methodStatic memberToBase36(Int64, String)
Converts the value of the specified number to hexatrigesimal format.
Public methodStatic memberToBase62(Int64)
Converts the value of the specified number to duosexagesimal format.
Public methodStatic memberToBase62(Int64, String)
Converts the value of the specified number to duosexagesimal format.
Public methodStatic memberToBaseX
Converts a specified value to another number system.
Public methodStatic memberToBoolean(Object)
Converts the value of the specified object to an equivalent Boolean value.
Public methodStatic memberToBoolean(Object, Boolean)
Converts the value of the specified object to an equivalent Boolean value.
Public methodStatic memberToBoolean(Object, Nullable Boolean )
Converts the value of the specified object to an equivalent Boolean value.
Public methodStatic memberToByte(Object)
Converts the value of the specified object to an 8-bit unsigned integer.
Public methodStatic memberToByte(Object, Byte)
Converts the value of the specified object to an 8-bit unsigned integer.
Public methodStatic memberToByte(Object, Nullable Byte )
Converts the value of the specified object to an 8-bit unsigned integer.
Public methodStatic memberToDateTime(Object)
Converts the value of the specified object to a DateTime object.
Public methodStatic memberToDateTime(Object, DateTime)
Converts the value of the specified object to a DateTime object.
Public methodStatic memberToDateTime(Object, Nullable DateTime )
Converts the value of the specified object to a DateTime object.
Public methodStatic memberToDateTime(Object, String)
Converts the value of the specified object to a DateTime object.
Public methodStatic memberToDateTime(Object, String, DateTime)
Converts the value of the specified object to a DateTime object.
Public methodStatic memberToDateTime(Object, String, Nullable DateTime )
Converts the value of the specified object to a DateTime object.
Public methodStatic memberToDateTime(Object, String, String)
Converts the value of the specified object to a DateTime object.
Public methodStatic memberToDateTime(Object, String, String, DateTime)
Converts the value of the specified object to a DateTime object.
Public methodStatic memberToDateTime(Object, String, String, Nullable DateTime )
Converts the value of the specified object to a DateTime object.
Public methodStatic memberToDateTime(Object, String, String, String)
Converts the value of the specified object to a DateTime object.
Public methodStatic memberToDateTime(Object, String, String, String, DateTime)
Converts the value of the specified object to a DateTime object.
Public methodStatic memberToDateTime(Object, String, String, String, Nullable DateTime )
Converts the value of the specified object to a DateTime object.
Public methodStatic memberToDecimal(Object)
Converts the value of the specified object to an equivalent decimal number.
Public methodStatic memberToDecimal(Object, Decimal)
Converts the value of the specified object to an equivalent decimal number.
Public methodStatic memberToDecimal(Object, Nullable Decimal )
Converts the value of the specified object to an equivalent decimal number.
Public methodStatic memberToDouble(Object)
Converts the value of the specified object to an double-precision floating-point number.
Public methodStatic memberToDouble(Object, Double)
Converts the value of the specified object to an double-precision floating-point number.
Public methodStatic memberToDouble(Object, Nullable Double )
Converts the value of the specified object to an double-precision floating-point number.
Public methodStatic memberToInt16(Object)
Converts the value of the specified object to a 16-bit signed integer.
Public methodStatic memberToInt16(Object, Int16)
Converts the value of the specified object to a 16-bit signed integer.
Public methodStatic memberToInt16(Object, Nullable Int16 )
Converts the value of the specified object to a 16-bit signed integer.
Public methodStatic memberToInt32(Object)
Converts the value of the specified object to a 32-bit signed integer.
Public methodStatic memberToInt32(Object, Int32)
Converts the value of the specified object to a 32-bit signed integer.
Public methodStatic memberToInt32(Object, Nullable Int32 )
Converts the value of the specified object to a 32-bit signed integer.
Public methodStatic memberToInt64(Object)
Converts the value of the specified object to a 64-bit signed integer.
Public methodStatic memberToInt64(Object, Int64)
Converts the value of the specified object to a 64-bit signed integer.
Public methodStatic memberToInt64(Object, Nullable Int64 )
Converts the value of the specified object to a 64-bit signed integer.
Public methodStatic memberToMoneyString(Object)
Returns a string containing a number formatted as a currency amount without penny. For example: 1 000 000
Public methodStatic memberToMoneyString(Object, Boolean)
Returns a string containing a number formatted as a currency amount. For example: 1 000.45
Public methodStatic memberToString(Object)
Converts the value of the specified object to a string.
Public methodStatic memberToString(Object, String)
Converts the value of the specified object to a string.
Public methodStatic memberToStringBuilder(Object)
Converts the value of the specified object to a StringBuilder object.
Public methodStatic memberToStringBuilder(Object, StringBuilder)
Converts the value of the specified object to a StringBuilder object.
Public methodStatic memberToTimeSpan(Object)
Converts the value of the specified object to a TimeSpan object.
Public methodStatic memberToTimeSpan(Object, Nullable TimeSpan )
Converts the value of the specified object to a TimeSpan object.
Public methodStatic memberToTimeSpan(Object, String)
Converts the value of the specified object to a TimeSpan object.
Public methodStatic memberToTimeSpan(Object, TimeSpan)
Converts the value of the specified object to a TimeSpan object.
Public methodStatic memberToTimeSpan(Object, String, Nullable TimeSpan )
Converts the value of the specified object to a TimeSpan object.
Public methodStatic memberToTimeSpan(Object, String, TimeSpan)
Converts the value of the specified object to a TimeSpan object.
Public methodStatic memberToUInt16(Object)
Converts the value of the specified object to a 16-bit unsigned integer.
Public methodStatic memberToUInt16(Object, Nullable UInt16 )
Converts the value of the specified object to a 16-bit unsigned integer.
Public methodStatic memberToUInt16(Object, UInt16)
Converts the value of the specified object to a 16-bit unsigned integer.
Public methodStatic memberToUInt32(Object)
Converts the value of the specified object to a 32-bit unsigned integer.
Public methodStatic memberToUInt32(Object, Nullable UInt32 )
Converts the value of the specified object to a 32-bit unsigned integer.
Public methodStatic memberToUInt32(Object, UInt32)
Converts the value of the specified object to a 32-bit unsigned integer.
Public methodStatic memberToUInt64(Object)
Converts the value of the specified object to a 64-bit unsigned integer.
Public methodStatic memberToUInt64(Object, Nullable UInt64 )
Converts the value of the specified object to a 64-bit unsigned integer.
Public methodStatic memberToUInt64(Object, UInt64)
Converts the value of the specified object to a 64-bit unsigned integer.
Top
Remarks

This class provides a type conversion without incurring exceptions.

DBNull values ​​are treated as null.

For floating-point numbers can be specified point or comma.

To obtain the date, you can specify the format in which it is presented.

Examples

Console.WriteLine("1.  {0}", Convertion.ToInt32("  123,456  "));
Console.WriteLine("2.  {0}", Convertion.ToInt32("28.01"));
Console.WriteLine("3.  {0}", Convertion.ToInt32(DBNull.Value));
Console.WriteLine("4.  {0}", Convertion.ToInt32(DBNull.Value, 555));
Console.WriteLine("5.  {0}", Convertion.ToDouble("  123,456  "));
Console.WriteLine("6.  {0}", Convertion.ToDouble("28.01"));
Console.WriteLine("7.  {0}", Convertion.ToBoolean("true"));
Console.WriteLine("8.  {0}", Convertion.ToBoolean("false"));
Console.WriteLine("9.  {0}", Convertion.ToBoolean("1"));
Console.WriteLine("10. {0}", Convertion.ToBoolean("0"));
Console.WriteLine("11. {0}", Convertion.ToBoolean("   123      "));
Console.WriteLine("12. {0}", Convertion.ToDateTime("31.12.1980", "dd.MM.yyyy"));
Console.WriteLine("13. {0}", Convertion.ToDateTime("12/31/1980", "MM/dd/yyyy"));
Console.WriteLine("14. {0}", Convertion.ToDateTime("23:59:01"));
Console.WriteLine("15. {0}", Convertion.ToDateTime(DBNull.Value));
Console.WriteLine("16. {0}", Convertion.ToDateTime(DBNull.Value, DateTime.Now));
Console.WriteLine("17. {0}", Convertion.ToBase16(16));
Console.WriteLine("18. {0}", Convertion.FromBase16("10"));
Console.WriteLine("19. {0}", Convertion.ToBase16(123123));
Console.WriteLine("20. {0}", Convertion.FromBase16("AF01"));
Console.WriteLine("21. {0}", Convertion.ToBase36(36));
Console.WriteLine("22. {0}", Convertion.FromBase36("10"));
Console.WriteLine("23. {0}", Convertion.ToBase36(123123));
Console.WriteLine("24. {0}", Convertion.FromBase36("ZYR1"));
Console.WriteLine("25. {0}", Convertion.ToBase62(62));
Console.WriteLine("26. {0}", Convertion.FromBase62("10"));
Console.WriteLine("27. {0}", Convertion.ToBase62(123123));
Console.WriteLine("28. {0}", Convertion.FromBase62("Nemiro"));
Console.WriteLine("29. {0}", Convertion.ToBase62(45102691578));
Console.WriteLine("30. {0}", Convertion.ToTimeSpan("12:10:59"));
Console.WriteLine("31. {0}", Convertion.ToTimeSpan(635456955015215351));
Results:
1.  123
2.  28
3.  0
4.  555
5.  123.456
6.  28.01
7.  True
8.  False
9.  True
10. False
11. False
12. 12/31/1980 00:00:00
13. 12/31/1980 00:00:00
14. 01/01/0001 23:59:01
15. 01/01/0001 00:00:00
16. 09/06/2014 18:05:12 (current date and time)
17. 10
18. 16
19. 1e0f3
20. 44801
21. 10
22. 36
23. 2n03
24. 1677997
25. 10
26. 62
27. w1R
28. 45102691578
29. Nemiro
30. 12:10:59
31. 735482.14:05:01.5215351
See Also