Home > Enterprise >  Error "Missing closing curly bracket" while all curly brackets are closed?
Error "Missing closing curly bracket" while all curly brackets are closed?

Time:11-30

I am trying to code a card game, and I'm making a shuffling system using a function, however it's telling me I need a closing bracket while all my brackets are closed. It's also asking me for an end-of-file or namespace definition. I'm using an online editor (dotnetfiddle.net) to edit this code, if that changes anything.

Here's my current code-

using System;
using System.Collections.Generic;

public class Program
{
    public static void Main()
    {
        Console.WriteLine("Hello World");
        List<string> shuffle(List<string> l) { //ERROR 1: } expected
            int count = l.Count-1;
            List<string> ret = new List<string>();
            int ind = 0;
            Random rng = new Random();
            string card = null;
            while (count > -1) {
                ind = rng.Next(0, count);
                card = l[ind];
                l.RemoveAt(ind);
                ret.Add(card);
                card = null;
                count--;
            }
            return ret;
        }
        List<List<string>> playerHands = new List<List<string>>();
        //           
  • Related