Transformations 0.0.21
See the version list below for details.
dotnet add package Transformations --version 0.0.21
NuGet\Install-Package Transformations -Version 0.0.21
<PackageReference Include="Transformations" Version="0.0.21" />
<PackageVersion Include="Transformations" Version="0.0.21" />
<PackageReference Include="Transformations" />
paket add Transformations --version 0.0.21
#r "nuget: Transformations, 0.0.21"
#addin nuget:?package=Transformations&version=0.0.21
#tool nuget:?package=Transformations&version=0.0.21
Conversion between data types. Envisaged as a possible alternative to the Universal Type Converter http://www.codeproject.com/Articles/248440/Universal-Type-Converter, with the provision for default values, and some extra features.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.1 | 414 | 4/17/2023 |
1.0.0 | 786 | 3/25/2020 |
0.0.145 | 2,823 | 7/4/2017 |
0.0.144 | 2,600 | 5/19/2017 |
0.0.143 | 2,537 | 5/18/2017 |
0.0.142 | 2,569 | 5/16/2017 |
0.0.140 | 3,038 | 11/4/2016 |
0.0.139 | 2,860 | 11/4/2016 |
0.0.138 | 2,812 | 11/3/2016 |
0.0.137 | 2,804 | 11/3/2016 |
0.0.136 | 2,850 | 11/3/2016 |
0.0.135 | 2,807 | 11/2/2016 |
0.0.134 | 2,768 | 11/2/2016 |
0.0.133 | 2,792 | 11/2/2016 |
0.0.132 | 2,807 | 11/2/2016 |
0.0.131 | 2,858 | 11/2/2016 |
0.0.130 | 2,702 | 11/2/2016 |
0.0.129 | 2,723 | 12/14/2015 |
0.0.128 | 2,733 | 12/11/2015 |
0.0.127 | 2,632 | 12/10/2015 |
0.0.126 | 2,805 | 12/9/2015 |
0.0.125 | 2,675 | 11/20/2015 |
0.0.124 | 2,637 | 11/20/2015 |
0.0.123 | 2,663 | 11/20/2015 |
0.0.122 | 2,675 | 11/20/2015 |
0.0.121 | 2,662 | 11/20/2015 |
0.0.120 | 2,685 | 11/20/2015 |
0.0.119 | 2,676 | 11/17/2015 |
0.0.118 | 2,717 | 11/17/2015 |
0.0.117 | 2,704 | 11/17/2015 |
0.0.116 | 2,683 | 11/17/2015 |
0.0.115 | 2,655 | 11/17/2015 |
0.0.114 | 3,087 | 11/16/2015 |
0.0.113 | 2,621 | 11/16/2015 |
0.0.112 | 2,803 | 11/16/2015 |
0.0.111 | 2,669 | 11/12/2015 |
0.0.110 | 2,595 | 11/12/2015 |
0.0.109 | 2,593 | 11/3/2015 |
0.0.108 | 2,616 | 11/3/2015 |
0.0.107 | 2,652 | 11/3/2015 |
0.0.106 | 2,659 | 11/2/2015 |
0.0.105 | 2,622 | 11/2/2015 |
0.0.104 | 2,604 | 10/30/2015 |
0.0.103 | 2,630 | 10/30/2015 |
0.0.102 | 2,634 | 10/30/2015 |
0.0.101 | 2,614 | 10/30/2015 |
0.0.100 | 2,610 | 10/30/2015 |
0.0.99 | 2,592 | 10/23/2015 |
0.0.98 | 2,622 | 10/23/2015 |
0.0.97 | 2,624 | 10/19/2015 |
0.0.96 | 2,624 | 10/16/2015 |
0.0.95 | 2,680 | 10/16/2015 |
0.0.94 | 2,586 | 10/16/2015 |
0.0.93 | 2,633 | 10/16/2015 |
0.0.92 | 2,619 | 10/13/2015 |
0.0.91 | 2,641 | 10/13/2015 |
0.0.90 | 2,622 | 10/13/2015 |
0.0.89 | 2,704 | 9/16/2015 |
0.0.88 | 2,664 | 9/16/2015 |
0.0.87 | 2,694 | 8/20/2015 |
0.0.86 | 2,601 | 8/17/2015 |
0.0.85 | 2,960 | 8/6/2015 |
0.0.84 | 2,794 | 7/29/2015 |
0.0.83 | 2,804 | 7/29/2015 |
0.0.82 | 2,809 | 7/29/2015 |
0.0.81 | 2,763 | 7/28/2015 |
0.0.80 | 2,780 | 7/28/2015 |
0.0.79 | 2,752 | 7/27/2015 |
0.0.78 | 2,742 | 7/20/2015 |
0.0.77 | 2,789 | 7/20/2015 |
0.0.76 | 2,671 | 7/10/2015 |
0.0.75 | 2,641 | 7/10/2015 |
0.0.74 | 2,672 | 7/2/2015 |
0.0.73 | 2,671 | 7/2/2015 |
0.0.72 | 2,655 | 6/29/2015 |
0.0.71 | 2,623 | 6/29/2015 |
0.0.70 | 2,624 | 6/24/2015 |
0.0.69 | 2,656 | 6/23/2015 |
0.0.68 | 2,683 | 6/23/2015 |
0.0.67 | 2,667 | 6/22/2015 |
0.0.66 | 2,665 | 6/22/2015 |
0.0.65 | 2,641 | 6/5/2015 |
0.0.64 | 2,670 | 6/4/2015 |
0.0.63 | 2,660 | 6/4/2015 |
0.0.62 | 2,652 | 6/3/2015 |
0.0.61 | 2,691 | 6/2/2015 |
0.0.60 | 2,627 | 6/2/2015 |
0.0.59 | 2,831 | 6/1/2015 |
0.0.58 | 2,611 | 6/1/2015 |
0.0.57 | 2,860 | 6/1/2015 |
0.0.56 | 3,108 | 6/1/2015 |
0.0.55 | 2,602 | 5/29/2015 |
0.0.53 | 2,629 | 5/27/2015 |
0.0.52 | 2,617 | 5/27/2015 |
0.0.51 | 2,656 | 5/22/2015 |
0.0.50 | 2,637 | 5/21/2015 |
0.0.49 | 2,646 | 5/20/2015 |
0.0.48 | 2,635 | 5/20/2015 |
0.0.47 | 2,677 | 5/20/2015 |
0.0.46 | 2,646 | 5/20/2015 |
0.0.45 | 2,653 | 5/19/2015 |
0.0.44 | 2,643 | 5/19/2015 |
0.0.43 | 2,632 | 5/15/2015 |
0.0.42 | 2,598 | 5/14/2015 |
0.0.41 | 2,610 | 5/13/2015 |
0.0.40 | 2,632 | 5/12/2015 |
0.0.39 | 2,641 | 5/11/2015 |
0.0.38 | 2,654 | 5/7/2015 |
0.0.37 | 2,622 | 5/7/2015 |
0.0.36 | 2,612 | 5/7/2015 |
0.0.35 | 2,621 | 5/7/2015 |
0.0.34 | 2,602 | 5/7/2015 |
0.0.33 | 2,729 | 5/7/2015 |
0.0.32 | 2,641 | 5/6/2015 |
0.0.31 | 2,739 | 5/6/2015 |
0.0.30 | 2,643 | 5/6/2015 |
0.0.29 | 2,639 | 5/6/2015 |
0.0.28 | 2,729 | 5/6/2015 |
0.0.27 | 2,743 | 5/5/2015 |
0.0.26 | 2,641 | 5/5/2015 |
0.0.25 | 2,763 | 4/27/2015 |
0.0.24 | 2,778 | 4/24/2015 |
0.0.23 | 3,104 | 4/23/2015 |
0.0.22 | 2,925 | 4/2/2015 |
0.0.21 | 2,653 | 4/2/2015 |
0.0.20 | 2,666 | 4/1/2015 |
0.0.19 | 2,676 | 3/31/2015 |
0.0.18 | 2,741 | 3/31/2015 |
0.0.17 | 2,711 | 3/31/2015 |
0.0.16 | 2,682 | 3/31/2015 |
0.0.15 | 2,633 | 3/31/2015 |
0.0.14 | 2,689 | 3/31/2015 |
0.0.13 | 2,656 | 3/31/2015 |
0.0.12 | 2,622 | 3/30/2015 |
0.0.11 | 2,652 | 3/30/2015 |
0.0.10 | 2,660 | 3/30/2015 |
* You don't need to reference the transformations namespace with Using statement (type conversions are meant to be universal if you choose to use this).
Generally you would just do:
var newValue = oldValue.ConvertTo<newType>(optionalDefaultValue);
* You can use TryConvertTo if you need to get the result of the conversion process.
* You can do some conversions on DataTables and Lists , for example convert a data table to an object list, if the names of the columns match the object properties.
* The date conversion is set to British date format by default, not the project's current format. This may have to change to make the library more "universal".
* From some basic tests I have performed on universal type converter and this library, I found it to be a bit faster than the universal type converter...
********************************************
Some examples of use:
********************************************
string valueInput = "7F8C14B6-B3A8-4F71-8EFC-E5A7B35923B6";
Guid actual = valueInput.ConvertTo<Guid>(Guid.Empty);
// -----------------------------------------------
string valueInput = "0.1";
float actual = valueInput.ConvertTo<float>(0.0f);
// result = 0.1f;
// -----------------------------------------------
string valueInput = "15/02/2014";
DateTime actual = valueInput.ConvertTo<DateTime>(new DateTime(2000, 01, 01));
// result = new DateTime(2014, 02, 15);
// -----------------------------------------------
float? f = 123.524f;
int? i = f.ConvertTo<int>();
// result = 124;
// -----------------------------------------------
* You can convert date to 'excel'-type value:
DateTime d = new DateTime(2005, 5, 5);
d.ToDouble();
// or d.ToInt();
List conversions examples:
// -----------------------------------------------
List<int> l1 = new List<int>(new int[] { 2, 3, 4 });
List<float> l2 = l1.ConvertToList<int, float>();
// -----------------------------------------------
**************************************************
Some additional helper methods are added as extensions as well:
// -----------------------------------------------
*Proper Case*
string name = "mr john smith";
name.ProperCase();
// result = "Mr John Smith";
// -----------------------------------------------
*Insert Spaces*
string name = "MrJohnSmith";
name.InsertSpaces();
// result = "Mr John Smith";
// -----------------------------------------------
*Remove Chars* - removes multiple instances of the same string pattern from the string.
string name = "Mr John John Smith";
name.RemoveChars("John ");
// result = "Mr Smith";
// -----------------------------------------------
*Replace Ex* - replace multiple instances of the same string pattern in the string.
string s = "12345678901234567890";
s.ReplaceEx("2", "X");
// result = "1X345678901X34567890";
// -----------------------------------------------
*Is Date* - check if string is a date! assumes en-Gb as default culture at present..
string s = "14/02/2014";
if (IsDate(s))
{ ... }
if (IsDate(s, "en-GB"))
{ ... }
// -----------------------------------------------
{ Your comments are VERY welcome! }