I have a very simple question. This being said, I have tried to solve it by searching through stackexchange's previously answered questions but I came up short. This is because I want to know how to tell the program's entry point to access other classes.
I had previously written a simple finite state machine but the code got congested because I did not know how to break it up into classes. In my new program, I am trying to break it up so it can be better managed.
The entry point starts off by accessing the class I created, NewState(). If you run the code, you will observe that despite it compiling correctly, the function inside NewState() does not produce the Console.WriteLine statement I wanted it to.
So, my question is this:
How do I make my code access the static void State() method within the NewState class and display the Console.WriteLine statement?
Program class:
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Finite_State_Machine_3 { class Program { static void Main(string[] args) { new NewState(); } } } NewState class:
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Finite_State_Machine_3 { class NewState { static void State() { Console.WriteLine("Hello world"); } } }