API class to connect with web php today I coded a simple API class in C# with just a WebClient instance in each void and just simple voids to do simple things, can anyone give me any support in how I can improove it? Thanks. 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace uTune.Base.Api
{
    class API
    {
        /// &lt;summary&gt;
        /// Runs a website script vue a url.
        /// &lt;/summary&gt;
        /// &lt;param name="url"&gt;URL to run.&lt;/param&gt;
        public void runScript(string url)
        {
            WebClient client = new WebClient();
            client.DownloadString(url);
        }

        /// &lt;summary&gt;
        /// Runs a website script with the option of multiple parameters
        /// &lt;/summary&gt;
        /// &lt;param name="url"&gt;URL to run.&lt;/param&gt;
        /// &lt;param name="parameters"&gt;A list of parameters to include.&lt;/param&gt;
        public void runScriptWithParameters(string url, Dictionary&lt;string, string&gt; parameters)
        {
            string urlToRun = url;
            bool firstParam = true;

            if (parameters.Count &gt; 0)
            {
                foreach (KeyValuePair&lt;string, string&gt; parameter in parameters)
                {
                    if (firstParam)
                    {
                        urlToRun += "?" + parameter.Key + "=" + parameter.Value;
                        firstParam = false;
                    }
                    else
                    {
                        urlToRun += "&amp;" + parameter.Key + "=" + parameter.Value;
                    }
                }
            }

            runScript(urlToRun);
        }

        /// &lt;summary&gt;
        /// Returns the pages content after a script has been executed.
        /// &lt;/summary&gt;
        /// &lt;param name="url"&gt;URL to get the content from.&lt;/param&gt;
        /// &lt;returns&gt;Webpages content.&lt;/returns&gt;
        public string getScriptReturn(string url)
        {
            WebClient client = new WebClient();
            return client.DownloadString(url);
        }

        /// &lt;summary&gt;
        /// Returns the pages conect after a script has been executed.
        /// &lt;/summary&gt;
        /// &lt;param name="url"&gt;URL to get the content form.&lt;/param&gt;
        /// &lt;param name="parameters"&gt;Parameters included in the URL.&lt;/param&gt;
        /// &lt;returns&gt;Webpages content&lt;/returns&gt;
        public string getScriptReturnWithParameters(string url, Dictionary&lt;string, string&gt; parameters)
        {
            string urlToRun = url;
            bool firstParam = true;

            if (parameters.Count &gt; 0)
            {
                foreach (KeyValuePair&lt;string, string&gt; parameter in parameters)
                {
                    if (firstParam)
                    {
                        urlToRun += "?" + parameter.Key + "=" + parameter.Value;
                        firstParam = false;
                    }
                    else
                    {
                        urlToRun += "&amp;" + parameter.Key + "=" + parameter.Value;
                    }
                }
            }

            return getScriptReturn(urlToRun);
        }
    }
}
both methods, runScriptWithParameters and getScriptReturnWithParameters have a lot of code in common which should be extracted to a separate method.  
using string concatenation by using += will create each time a new string because strings are immutable. A better way would be to use a StringBuilder instead.  
based on the .NET naming guidelines methods should be named using PascalCase casing.  
the check for if (parameters.Count &gt; 0) is not needed, because if you get the enumerator and there are no items to enumerate over, the loops is just ending.  
you don't do any null validation on the methods parameters of your public methods. Omitting these will leak implementation details.  
you should use the var type whenever the type is obvious form the right hand of the assignment.  


Implementing some of the mentioned points will lead to  

private string ComposeUrlParameters(Dictionary&lt;string, string&gt; parameters)
{
    var builder = new StringBuilder(1024);
    var firstParameter = true;
    foreach (var parameter in parameters)
    {
        if (firstParameter)
        {
            builder.Append("?");
            firstParameter = false;
        }
        else
        {
            builder.Append("&amp;");
        }
        builder.AppendFormat("{0}={1}",parameter.Key, parameter.Value);
    }

    return builder.ToString();
}  


which then can be called like so  

public void RunScriptWithParameters(string url, Dictionary&lt;string, string&gt; parameters)
{
    if (url == null) { throw new ArgumentNullException("url"); }
    if (parameters == null) { throw new ArgumentNullException("parameters"); }  

    var urlToRun = url + ComposeUrlParameters(parameters);
    RunScript(urlToRun);
}


You could compose the url parameters with linq as well like so  

private string ComposeUrlParameters(Dictionary&lt;string, string&gt; parameters)
{
    if (parameters.Count == 0)
    {
        return string.Empty;
    }

    var builder = new StringBuilder(1024);
    var firstParameter = parameters.First();

    builder.AppendFormat("?{0}={1}",firstParameter.Key, firstParameter.Value);

    foreach (var parameter in parameters.Skip(1)
    {
        builder.AppendFormat("&amp;{0}={1}",parameter.Key, parameter.Value);
    }

    return builder.ToString();
}