So I am new to C# and done some researching on how to do this but I still don't get it.
I have 2 files, file foo
and file bar
. File foo
is my main file and I want to use a function from inside bar
inside foo
. The function's purpose is not important because I am just playing around for now. As of now it is an alternative method to print text into the console. I am getting this error message when I try to execute the command csc foo.cs
:
foo.cs(9,13): error CS0103: The name 'message' does not exist in the current context
foo.cs
using System;
namespace main
{
class program
{
static void Main(string[] args)
{
message.print("Hello World!"); //line 9
Console.ReadLine();
}
}
}
bar.cs
using System;
namespace main
{
public class message
{
public void print(string Message)
{
Console.WriteLine(Message);
}
}
}
any help would be much appreciated
ALSO: note that both files are in the same directory and both classes are in the same namespace.
Because screenshot was requested