Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6338037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:21:57+00:00 2026-05-24T19:21:57+00:00

I am using visual studio 2010. It seems that out of nowhere, I can’t

  • 0

I am using visual studio 2010.

It seems that out of nowhere, I can’t use Console.WriteLine()

For example now I do:

  • File -> New project
  • Visual C# -> Console Application

Inside the Main method. Everything works fine. This works as expected:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Works!");
            Console.ReadLine();
        }
    }
}

Now when I add a new class, by clicking Test -> Add -> Class

Inside this new class I can’t call Console.Writeline() or anything rather.

Visual studio is already not suggesting it, but I ran it just in case and so that I could share the error and it gave me:

Error   1   El token '(' no es válido en una clase, un struct o una declaración de miembro de interfaz  c:\users\trufa\documents\visual studio 2010\Projects\Test\Test\Class1.cs    10  26  Test

The translation would be:

The token "(" is not valid in a class, a struct, or interface member declaration...

Any ideas as to why this is happening?

It really seamed to happen out of nowhere.

I didn’t think the question was for superuser but let me know if you think otherwise.

EDIT, Full code as is:

Program.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Works!");
            Console.ReadLine();
        }
    }
}

Class1.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Test
{

    class Class1
    {
        Console.WriteLine("Works!");//this one gives me the error
    }
}

Just in case:

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:21:58+00:00Added an answer on May 24, 2026 at 7:21 pm

    Have you typed the code directly into the class rather than placing in a method e.g?

    public class Class1
    {
       Console.WriteLine();
    }
    

    Gives me the error

    Error 32 Invalid token ‘(‘ in class, struct, or interface member
    declaration …\Class1.cs 10 21 ConsoleTester

    EDIT

    Place the call inside a method, then it will compile. You can’t place calls like that directly in the class itself.

    public class Class1
    {
       public void Test()
       {
          Console.WriteLine();
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have developers using Visual Studio 2010 professional and some trying out Visual Studio
I'm using Visual Studio 2010 RC. Would it be possible that after doing my
Using Visual Studio 2010 I created an Office 2010 Word add-in project that has
We are using Visual Studio 2010 connected to Team Foundation Server 2010 and we
I am using Visual Studio 2010 to create a setup project for my .NET
I am using Visual Studio 2010 SP1 Ultimate on a c# class library project
I am using Visual Studio 2010 RC1. I define a resource Brush2 in app.xaml_:
I am using Visual Studio 2010 Ultimate Beta 2. What is the relevant namespace/classes
I'm using Visual Studio 2010 RTM with .NET/Entity Framework 4 RTM with a model
i am using visual studio 2010. i have a three dimensional structure array which,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.