C# Noob, using console.writeline

Okay, so my question is how do I get the following request to print existing closed orders.
I’m not sure what to put in the console.writeline(); argument. This is what I have so far(paper account):
public static async Task ExistingOrders()
{

        //API connection
        var client = Environments.Paper.GetAlpacaTradingClient(new SecretKey(KEY_ID,   SECRET_KEY));
        
        // Get closed orders
        var closedOrders1  = await client.ListOrdersAsync(new ListOrdersRequest
            {
                LimitOrderNumber = 100,
                OrderStatusFilter = OrderStatusFilter.Closed
            }
        );

       
       Console.Read();
       Console.WriteLine();  <-- how do I get it to print the last 100 orders? 

Any help is appreciated. Thank you!

foreach(var order in closedOrders1)
{
   Console.WriteLine($"Order Id: {order.OrderId}");
}
1 Like

thank you! I wasn’t sure how to call the OrderId.
Thanks so much! :+1: :+1: :+1: :+1:
-A

Ok to answer my own question: What I was doing is creating separate methods and using a constructor to call and run them in the Main()
After some research, using async task(), I needed to add Console.ReadKey(); to make it print in the Terminal.
So, if you are a noob like me and are running async methods and Console.WriteLine(); won’t work, you’ll have to add your method in the Main and then add Console.ReadKey(); and that should work!!