Convert C Sharp to YAML

Hello Experts,

Can someone let me know if there are any tools/applications that could convert the following code to YAMl

using System.Net;

const double revenuePerkW = 0.12; 
const double technicianCost = 250; 
const double turbineCost = 100;

public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{   

    //Get request body
    dynamic data = await req.Content.ReadAsAsync<object>();
    int hours = data.hours;
    int capacity = data.capacity;

    //Formulas to calculate revenue and cost
    double revenueOpportunity = capacity * revenuePerkW * 24;  
    double costToFix = (hours * technicianCost) +  turbineCost;
    string repairTurbine;

    if (revenueOpportunity > costToFix){
        repairTurbine = "Yes";
    }
    else {
        repairTurbine = "No";
    }

    return req.CreateResponse(HttpStatusCode.OK, new{
        message = repairTurbine,
        revenueOpportunity = "$"+ revenueOpportunity,
        costToFix = "$"+ costToFix         
    }); 
}

Open in new window


Much appreciated.

Cheers

Carlton
LVL 1
Member_2_7966113Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David FavorLinux/LXD/WordPress/Hosting SavantCommented:
YAML is a data representation model, rather than code.

Maybe you're asking about how to convert the data (output from code above) into YAML.

If you're asking about data conversion, post a copy of your data + likely someone can assist.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Member_2_7966113Author Commented:
Hi David

Thanks for responding.

I didnt realise that YAML wasn’t code. I need to think about this in more detail

Cheers
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Good luck!
Member_2_7966113Author Commented:
Thanks David
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.