StringToStronglyTyped 0.1.1

A simple utility to convert string values to strongly-typed objects.

Install-Package StringToStronglyTyped -Version 0.1.1
dotnet add package StringToStronglyTyped --version 0.1.1
<PackageReference Include="StringToStronglyTyped" Version="0.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add StringToStronglyTyped --version 0.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

StringToStronglyTyped

A simple utility to convert string values to strongly-typed objects.

NuGet

Examples

Converting a string to another type


int @int = StronglyTypedConverter.ToType<int>("123");

decimal @decimal = StronglyTypedConverter.ToType<decimal>("123.456");

Converting a Hashtable to a Strongly-typed object

public class TestModel
{
    [StronglyTypedMetadata]
    public short Int16 { get; private set; }

    [StronglyTypedMetadata]
    public decimal Decimal { get; private set; }  
}

...

var hashtable = new Hashtable();
hashtable.Add("Int16", "123");
hashtable.Add("Decimal", "0.123");

var testModel = StronglyTypedConverter.ToType<TestModel>(hashtable);

StringToStronglyTyped

A simple utility to convert string values to strongly-typed objects.

NuGet

Examples

Converting a string to another type


int @int = StronglyTypedConverter.ToType<int>("123");

decimal @decimal = StronglyTypedConverter.ToType<decimal>("123.456");

Converting a Hashtable to a Strongly-typed object

public class TestModel
{
    [StronglyTypedMetadata]
    public short Int16 { get; private set; }

    [StronglyTypedMetadata]
    public decimal Decimal { get; private set; }  
}

...

var hashtable = new Hashtable();
hashtable.Add("Int16", "123");
hashtable.Add("Decimal", "0.123");

var testModel = StronglyTypedConverter.ToType<TestModel>(hashtable);

  • .NETStandard 2.0

    • No dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.1.1 64 6/20/2019