-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
  • 11,287
  • 7
  • 39
  • 62
dandan
  • 509
  • 3
  • 8
  • 21

1 Answers1

0

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

kirilljk
  • 54
  • 1
  • 4