-1

I have a simple class:

namespace Test
{
    public class Person
    {
        public string Name { get; set; }
        public string Age { get; set; }

        public void PrintName()
        {
            Console.WriteLine("Name:{0} Age:{1}", Name, Age); //<= I can print Name & Age
        }

        public static (double A, double B) DoSomething(string someString)
        {
            double distance = AnotherClass.AnotherMethod(Name, Age); //<= VS will not allow me to pass Name & Age.
        }
    }
}

How do I pass the values of Name & Age to a method in another class?

Carsten
  • 10,857
  • 7
  • 38
  • 58
dandan
  • 507
  • 2
  • 7
  • 19

1 Answers1

0

You cannot do this for the static method. Remove 'static' word and it will work.

kirilljk
  • 54
  • 1
  • 4