user4823: I am trying to use the following example code for C# programming, so I can connect to my own bitcoin full node:
https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#.NET_.28C.23.29
Which has resulted in something like this:
public static string RequestServer(string methodName, List<string> parameters)
{
    string ServerIp = "http://localhost:18332";
    string UserName = "user name goes here";
    string Password = "password goes here";

    HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(ServerIp);
    webRequest.Credentials = new NetworkCredential(UserName, Password);

    webRequest.ContentType = "application/json-rpc";
    webRequest.Method = "POST";

    string respVal = string.Empty;

    JObject joe = new JObject();
    joe.Add(new JProperty("jsonrpc", "1.0"));
    joe.Add(new JProperty("id", "1"));
    joe.Add(new JProperty("method", methodName));

    JArray props = new JArray();
    foreach (var parameter in parameters)
    {
        props.Add(parameter);
    }

    joe.Add(new JProperty("params", props));

    // serialize json for the request
    string s = JsonConvert.SerializeObject(joe);
    byte[] byteArray = Encoding.UTF8.GetBytes(s);
    webRequest.ContentLength = byteArray.Length;

    Stream dataStream = webRequest.GetRequestStream();
    dataStream.Write(byteArray, 0, byteArray.Length);
    dataStream.Close();

    StreamReader streamReader = null;
    try
    {
        WebResponse webResponse = webRequest.GetResponse();

        streamReader = new StreamReader(webResponse.GetResponseStream(), true);

        respVal = streamReader.ReadToEnd();
        var data = JsonConvert.DeserializeObject(respVal).ToString();
        return data;
    }
    catch (Exception exp)
    {
        throw (exp);
    }
    finally
    {
        if (streamReader != null)
        {
            streamReader.Close();
        }
    }

    return string.Empty;
}

The above code allows me to run the bitcoin command sendtoaddress.  For example, the following would work in the bitcoin console:
senttoaddress 2N8hwP1WmJrFF5QWABn38y63uYLhnJYJYTF 0.01
Using the RequestServer function in the C# code above, I can do the same thing like this:
double AmountToSend = Convert.ToDouble(txtAmountToSend.Text);
string ReceivingAddress = txtSendToAddress.Text;
JObject data = JObject.Parse(RequestServer("sendtoaddress", new List<string>() { ReceivingAddress, Convert.ToString(AmountToSend) }));

All good so far.
Now I want to do the same with listunspent
In the bitcoin console, the following work examples work fine:
listunspent
listunspent 1000

Using the C# function above, the following works if I do not give it a parameter:
JObject data = JObject.Parse(RequestServer("listunspent", new List<string>() { }));
But when I add a parameter, it does not work:
JObject data = JObject.Parse(RequestServer("listunspent", new List<string>() { Convert.ToString(1000) }));
The error it gives is:
C:\Users\oshirowanen\Documents\Visual Studio 2017\Projects\ConsoleApp1\ConsoleApp1\bin\Debug>ConsoleApp1.exe

Unhandled Exception: System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
   at System.Net.HttpWebRequest.GetResponse()
   at ConsoleApp1.Program.RequestServer(String methodName, List`1 parameters) in C:\Users\oshirowanen\Documents\Visual Studio 2017\Projects\ConsoleApp1\ConsoleApp1\Program.cs:line 63
   at ConsoleApp1.Program.Main(String[] args) in C:\Users\oshirowanen\Documents\Visual Studio 2017\Projects\ConsoleApp1\ConsoleApp1\Program.cs:line 18

C:\Users\oshirowanen\Documents\Visual Studio 2017\Projects\ConsoleApp1\ConsoleApp1\bin\Debug>

Anyone know why that is?

user48884: The issue is that you are sending the 1000 parameter as a string, not as a number. The JSON type when the RPC server receives it will be a string, which is incorrect. It does not convert this to an integer implicitly so you need to explicitly set the type. So instead you should be doing:
JObject data = JObject.Parse(RequestServer("listunspent", new List<Integer>() { 1000 }));


4823: <p>I am trying to use the following example code for C# programming, so I can connect to my own bitcoin full node:</p>

<p><a href="https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#.NET_.28C.23.29" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#.NET_.28C.23.29</a></p>

<p>Which has resulted in something like this:</p>

<pre><code>public static string RequestServer(string methodName, List&lt;string&gt; parameters)
{
    string ServerIp = "http://localhost:18332";
    string UserName = "user name goes here";
    string Password = "password goes here";

    HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(ServerIp);
    webRequest.Credentials = new NetworkCredential(UserName, Password);

    webRequest.ContentType = "application/json-rpc";
    webRequest.Method = "POST";

    string respVal = string.Empty;

    JObject joe = new JObject();
    joe.Add(new JProperty("jsonrpc", "1.0"));
    joe.Add(new JProperty("id", "1"));
    joe.Add(new JProperty("method", methodName));

    JArray props = new JArray();
    foreach (var parameter in parameters)
    {
        props.Add(parameter);
    }

    joe.Add(new JProperty("params", props));

    // serialize json for the request
    string s = JsonConvert.SerializeObject(joe);
    byte[] byteArray = Encoding.UTF8.GetBytes(s);
    webRequest.ContentLength = byteArray.Length;

    Stream dataStream = webRequest.GetRequestStream();
    dataStream.Write(byteArray, 0, byteArray.Length);
    dataStream.Close();

    StreamReader streamReader = null;
    try
    {
        WebResponse webResponse = webRequest.GetResponse();

        streamReader = new StreamReader(webResponse.GetResponseStream(), true);

        respVal = streamReader.ReadToEnd();
        var data = JsonConvert.DeserializeObject(respVal).ToString();
        return data;
    }
    catch (Exception exp)
    {
        throw (exp);
    }
    finally
    {
        if (streamReader != null)
        {
            streamReader.Close();
        }
    }

    return string.Empty;
}
</code></pre>

<p>The above code allows me to run the bitcoin command <code>sendtoaddress</code>.  For example, the following would work in the bitcoin console:</p>

<p><code>senttoaddress 2N8hwP1WmJrFF5QWABn38y63uYLhnJYJYTF 0.01</code></p>

<p>Using the <code>RequestServer</code> function in the C# code above, I can do the same thing like this:</p>

<pre><code>double AmountToSend = Convert.ToDouble(txtAmountToSend.Text);
string ReceivingAddress = txtSendToAddress.Text;
JObject data = JObject.Parse(RequestServer("sendtoaddress", new List&lt;string&gt;() { ReceivingAddress, Convert.ToString(AmountToSend) }));
</code></pre>

<p>All good so far.</p>

<p>Now I want to do the same with <code>listunspent</code></p>

<p>In the bitcoin console, the following work examples work fine:</p>

<pre><code>listunspent
listunspent 1000
</code></pre>

<p>Using the C# function above, the following works if I do not give it a parameter:</p>

<p><code>JObject data = JObject.Parse(RequestServer("listunspent", new List&lt;string&gt;() { }));</code></p>

<p>But when I add a parameter, it does not work:</p>

<p><code>JObject data = JObject.Parse(RequestServer("listunspent", new List&lt;string&gt;() { Convert.ToString(1000) }));</code></p>

<p>The error it gives is:</p>

<pre><code>C:\Users\oshirowanen\Documents\Visual Studio 2017\Projects\ConsoleApp1\ConsoleApp1\bin\Debug&gt;ConsoleApp1.exe

Unhandled Exception: System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
   at System.Net.HttpWebRequest.GetResponse()
   at ConsoleApp1.Program.RequestServer(String methodName, List`1 parameters) in C:\Users\oshirowanen\Documents\Visual Studio 2017\Projects\ConsoleApp1\ConsoleApp1\Program.cs:line 63
   at ConsoleApp1.Program.Main(String[] args) in C:\Users\oshirowanen\Documents\Visual Studio 2017\Projects\ConsoleApp1\ConsoleApp1\Program.cs:line 18

C:\Users\oshirowanen\Documents\Visual Studio 2017\Projects\ConsoleApp1\ConsoleApp1\bin\Debug&gt;
</code></pre>

<p>Anyone know why that is?</p>
 48884: <p>The issue is that you are sending the <code>1000</code> parameter as a string, not as a number. The JSON type when the RPC server receives it will be a string, which is incorrect. It does not convert this to an integer implicitly so you need to explicitly set the type. So instead you should be doing:</p>

<pre><code>JObject data = JObject.Parse(RequestServer("listunspent", new List&lt;Integer&gt;() { 1000 }));
</code></pre>
