Property does not exist in the current context

后端 未结 4 1366
旧时难觅i
旧时难觅i 2021-01-29 00:54

I\'m getting the following error :

\"Property does not exist in the current context\".

I checked on StackOverflow the usual causes

4条回答
  •  误落风尘
    2021-01-29 01:27

    There are two problems with your code.

    1. Marque is an int and you are trying to set a string
    2. You can't access the property outside a method or constructor.

    Use this instead and you'll find out about problem 1

    public Audi()
    {
        this.Marque = "Audi";
    }
    

提交回复
热议问题