How do I invoke a method from a class?

Asked 2 years ago, Updated 2 years ago, 50 views

class sample
    {
        public void sample_method()
        {
            Test (); // Call Error
        }
    }

    public void test()
    {
        Console.WriteLine("Call Complete";
    }

In this case, how do I write the test method to call it?
visual studio express 2015 (windows1064bit)

c# visual-studio

2022-09-30 13:59

1 Answers

class sample
{
    public void sample_method()
    {
        Test (); // Call Error
    }

    public void test()
    {
        Console.WriteLine("Call Complete";
    }
}

Like this?
Do you mean you want to call a method in a different class?


2022-09-30 13:59

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.