documentation.

This commit is contained in:
David Lebée 2018-04-17 21:35:42 -05:00
parent 96cfb46de2
commit 91015866b5
3 changed files with 36 additions and 1 deletions

View File

@ -61,7 +61,7 @@ namespace PoweredSoft.Types.Test
var a1 = "12345";
var b1 = a1.To(typeof(int?));
Assert.AreEqual(b1, 12345);
Assert.AreEqual(12345, b1);
}
}
}

View File

@ -7,6 +7,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PoweredSoft.Types", "Powere
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.Types.Test", "PoweredSoft.Types.Test\PoweredSoft.Types.Test.csproj", "{7CB0B9D3-8B0C-4A3E-9A1B-8DB4A8C4646E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{19332C1E-B9CD-4332-9F1E-D237611DF59B}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU

30
README.md Normal file
View File

@ -0,0 +1,30 @@
## Download
Full Version | NuGet | NuGet Install
------------ | :-------------: | :-------------:
PoweredSoft.Types | <a href="https://www.nuget.org/packages/PoweredSoft.Types/" target="_blank">[![NuGet](https://img.shields.io/nuget/v/PoweredSoft.Types.svg?style=flat-square&label=nuget)](https://www.nuget.org/packages/PoweredSoft.Types/)</a> | ```PM> Install-Package PoweredSoft.Types```
## Reason of package
This package is for other packages of our company, but if you find usage for it, enjoy.
# Sample
```csharp
var codeStr = "123";
var code = codeStr.To(typeof(int));
Assert.Equal(123, code);
```
# Adding converters or replacing default converters
```csharp
class StringToIntConverter : ITypeConverter
{
public bool CanConvert(Type source, Type destination) => source == typeof(string) && destination == typeof(int);
public object Convert(object source, Type destination) => Convert.ToInt32(source);
}
Converter.RegisterConverter(new ConverterClass());
Converter.ReplaceConverter(new ConverterClass(), typeof(string), typeof(int));
```