Answer the question
In order to leave comments, you need to log in
How to specify a class in c#?
Good afternoon.
I ran into a problem when creating classes and methods in c#
I use the mono compiler
//MethodsTest.cs
using System;
namespace AAA
{
class Program
{
static void Main(string[] args)
{
int result;
FindingMax findingMax = new FindingMax();
result = findingMax.MaxNumber(12, 14);
Console.WriteLine(result);
}
}
}
//FindingMax.cs
using System;
namespace AAA
{
class FindingMax
{
public int MaxNumber(int x, int y)
{
int result;
if (x > y)
{
result = x;
}
else
{
result = y;
}
return result;
}
}
}
Answer the question
In order to leave comments, you need to log in
You are compiling a single file.
I advise you to install the .NET SDK and create a project through it using dotnet new console .
csc should not be used directly
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question