-2

I want to use a method from one file (class) in another one. You can see

// first class file
namespace AutomatskI
{
    class Method{
         public void client()
         {
           // some code
         }
// second class file
namespace AutomatskaIA
{
    class AutomaticTestRun
        public void login()
           {
             // Here i want to use that code
              client();
           }

Manngo
  • 23
  • 4

1 Answers1

0

You should reference your first library in the second one

// Reference your first library like this
using AutomatskI;

namespace AutomatskaIA
{
    class AutomaticTestRun
    {
        public void login()
        {
            // Then reach this class method like this
            Method method = new Method();
            method.client();
            // Or use a static class instead by putting a 'static' tag in class name. 
            // So you don't have to create an instance of this class in order
            // to use its methods. Then you can do it like this:
            // Method.client();
        }
 // ...

And please format your code before posting so people would have an easier time reading your code.

Abdullah Akçam
  • 299
  • 4
  • 18