calling methods across classes c# code example
Example 1: c# how to call methods from another class
public class AllMethods
{
public static void Method2()
{
}
}
class Caller
{
public static void Main(string[] args)
{
AllMethods.Method2();
}
}
Example 2: c# how to call methods from another class
namespace Some.Namespace
{
public class AllMethods
{
public static void Method2()
{
}
}
}
using static Some.Namespace.AllMethods;
namespace Other.Namespace
{
class Caller
{
public static void Main(string[] args)
{
Method2();
}
}
}