Answers for "how to call a method from a class c#]"

C#
0

c# how to call methods from another class

// AllMethods.cs
namespace Some.Namespace
{
    public class AllMethods
    {
        public static void Method2()
        {
            // code here
        }
    }
}

// Caller.cs
using static Some.Namespace.AllMethods;

namespace Other.Namespace
{
    class Caller
    {
        public static void Main(string[] args)
        {
            Method2(); // No need to mention AllMethods here
        }
    }
}
Posted by: Guest on September-30-2020

Code answers related to "how to call a method from a class c#]"

C# Answers by Framework

Browse Popular Code Answers by Language