Skip to content

Start in 4 steps

Lorenz Lo Sauer edited this page Oct 3, 2016 · 1 revision

   1. Install with the NuGet Package manager:

        PM> Install-Package Core.Cast-Transform-Convert

   2. Add the namespace to your top-listed using directives:

        using Core.TypeCast;

   3. Create a class with one or more methods:

        using Core.TypeCast;

        class MyConverter 
        {
            ...
        }

   4. Attribute any class:

        using Core.TypeCast;

        [Converter]
        class MyConverter 
        {
            ... 
        }
    Subsequently, attribute the methods:
        using Core.TypeCast;

        [Converter]
        class MyConverter 
        {
            [ConverterMethod]
            public int MyIntConverterMethod(string argument) 
            { 
                ... ... ... 
            } 
        }

   5. Done!

Now, invoke conversions in your code anywhere as follows:

    var castedInt = "500s".CastTo<int>();
    var protein = "GAGTGCGCCCTCCCCGCACATGCGCCCTGACAGCCCAACAATGGCGGCGCCCGCGGAGTC".ConvertTo<IProtein>();

Use library functions which suit the change of type descriptively:

`var complimentary = "GAGTGCGCCCTCCCCGCACATGCGCCCTGACAGCCCAACAATGGCGGCGCCCGCGGAGTC".Transform<Complementary>();`