Skip to content

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

License

Notifications You must be signed in to change notification settings

conradyacat/StringToStronglyTyped

Repository files navigation

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);

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages