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

  • Home
  • SEARCH
  • 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 8785733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:26:28+00:00 2026-06-13T21:26:28+00:00

My idea here is to create a text based adventure game. I’m trying to

  • 0

My idea here is to create a text based adventure game.

I’m trying to use a class in my main class.
While I’m trying to, it gives me the error:

‘MyAdventure.Window’ is a ‘type’ but is used like a ‘variable’

I’m not sure on how to solve this. I tried creating a new instance of the class but it didn’t seem to work.
I am fairly new to this, but could anyone please help?

Thanks in advance.

Here’s the code for my main class (Program.cs):

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

namespace MyAdventure
{
class Program
{
    static void Main(string[] args)
    {

        Console.WriteLine("You cannot feel your body. You don't know where you are.\nThe room you're in is dark. You cannot see much.");
        Console.WriteLine("You decide to stand up, and take a look around. You see a door and a window.\nWhich do you check out first?");
        Console.WriteLine("A. Window\nB. Door");

        string userInput = Console.ReadLine();
        //Window theWindow = new Window();

        if (userInput.StartsWith("A", StringComparison.CurrentCultureIgnoreCase))
        {
            Window();
        }
        else if (userInput.StartsWith("B", StringComparison.CurrentCultureIgnoreCase))
        {
            Console.WriteLine("You chose the door.");
        }

        Console.ReadKey();

    }
}

}

And this is the code (so far) for the other class Window.cs:

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

namespace MyAdventure
{
public class Window
{
    static void theWindow()
    {

        Console.WriteLine("You approach the window.");
        Console.ReadKey();

    }
}

}

  • 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-06-13T21:26:29+00:00Added an answer on June 13, 2026 at 9:26 pm

    The correct syntax to call a static method of a class is the following

       if (userInput.StartsWith("A", StringComparison.CurrentCultureIgnoreCase))
       {
            Window.theWindow();
       }
    

    You can’t use simply the name of the class, but you should specify the static method to call (one from potentially many methods)

    Calling static methods

    Also the method ‘theWindow’ should be made public otherwise is private by default inside a class

    access level for class members and struct members, including nested
    classes and structs, is private by default

    public static void theWindow()
    {
        Console.WriteLine("You approach the window.");
        Console.ReadKey();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's an idea. I'm trying to create file from PHP script. File may be
My Question is similar to the idea here: Replacing a component class in delphi
I am attempting to create a wrapper class for Google Android's Text-To-Speech functionality. However,
I'm trying to create some OS X like text inputs for my website. They've
i had questioned here : Best idea for importing text to each NavigationController View
I'm trying to create a particular CSS button described here: http://www.2shared.com/file/5131551/412bd8a8/Sans_titre-1_copie.html Basically, it's a
Here is the code that I currently have to create underlined header text in
The idea here is to uninstall a program silently. Unfortunately the program's msi is
The idea here is to get better programmers right out of college. I think
I'm just looking a big picture idea here; I can google specifics once provided

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.