namespace ConsoleApplication3
{
public class EncapulationTest
{
public static void publicMethod()
{
Console.WriteLine("This is the public method from the EncapsulationTest class!");
}
private static void privateMethod()
{
Console.WriteLine("This is the private method from the EncapsulationTest class!");
}
}
public class Main
{
public static void Main()
{
publicMethod();
Console.ReadLine();
}
}
В качестве опции я не вижу или не вызываю метод publicMethod()
, и он говорит, что он не существует в текущем контексте.Нельзя вызвать публичный метод C#
Любая причина для этого, работая с ограниченным примером теории.
Error 1 'Main': member names cannot be the same as their enclosing type
Бросил код в новый проект и БАМ! Спасибо, парни!
'EncapulationTest.publicMethod()' –