# C# 246 error with RESTCLIENT in example code

**URL:** <https://forum.alpaca.markets/t/c-246-error-with-restclient-in-example-code/9824>\
**Category:** Alpaca Account Troubleshooting\
**Created:** [June 23, 2022, 12:05am UTC](https://forum.alpaca.markets/t/c-246-error-with-restclient-in-example-code/9824 "2022-06-23T00:05:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JustDave](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/justdave/32/4363_2.png) [@JustDave](https://forum.alpaca.markets/u/JustDave)\
**Post date:** [June 23, 2022, 12:05am UTC](https://forum.alpaca.markets/t/c-246-error-with-restclient-in-example-code/9824/1 "2022-06-23T00:05:45Z")

</div>

Visual Studio  
c# .NET 6.0  
Alpaca SDK 6.05

Wanted to try out this API and check out this example: [A Simple Mean Reversion Stock Trading Script in C#](https://alpaca.markets/learn/mean-reversion-stock-trading-csharp/)

wanted to see if I could adapt the code to what I need but wont run due to error and cant find a way around it

class MeanReversionPaperOnly  
{  
private string API\_KEY = “REPLACEME”;  
private string API\_SECRET = “REPLACEME”;  
private string API\_URL = “[https://paper-api.alpaca.markets](https://paper-api.alpaca.markets)”;

```
    private string symbol = "SPY";
    private Decimal scale = 200;

   private ***RestClient*** restClient;

    private Guid lastTradeId = Guid.NewGuid();
    private List<Decimal> closingPrices = new List<Decimal>();

    public void Run()
    {
       restClient = new ***RestClient*** (API_KEY, API_SECRET, API_URL);

        // First, cancel any existing orders so they don't impact our buying power.
        var orders = restClient.ListOrdersAsync().Result;
        foreach (var order in orders)
        {
            restClient.DeleteOrderAsync(order.OrderId);
        }

```
