class A
{
public void TestCallingMethod()
{
/*to call a method in the same class*/
Method_A();
/*to call a method in another public class*/
B b_object = new B();
b_object.Method_B();
}
public void Method_A()
{ }
}
class B
{
public void Method_B()
{ }
}
public class AllMethods
{
public static void Method2()
{
// code here
}
}
class Caller
{
public static void Main(string[] args)
{
AllMethods.Method2();
}
}
// 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
}
}
}
classname.methodname();