how to call non static method in window console application

前端 未结 5 1231
萌比男神i
萌比男神i 2021-01-24 22:16

I built a console application and I\'m trying to test if my application works as expected.
I create an instance of the API class as shown in the code below but I receive an

5条回答
  •  甜味超标
    2021-01-24 22:55

    You have declared the members you're passing to the function call as instance variables, but you're trying to access them from the scope of the static Main method. This is not possible, as the static Main method has no access to the member variables.

    Either declare them as static too, or use Test_API.ConStr for example as parameter to the method.

提交回复
热议问题