小编Mik*_*ray的帖子

如何解决“ *或->运算符必须应用于指针”的问题?

我正在使用Visual Studio 2019研究C#中的赋值运算符,但由于错误代码CS0193,该脚本未运行。

首先,像{c = + a}一样,更改了“ =”等号后的“ +”加号的位置,但仅适用于add和sub。我想使用{c * = a}但出现以下错误。

            int a = 21;

            int c =+ a;

            Console.WriteLine("1. Value of c is {0}", c );

            Console.WriteLine("2. Binery of c is {0}", Convert.ToString(c, 2));

            Console.ReadLine();
Run Code Online (Sandbox Code Playgroud)

根据我的书很好,它应该像(x-= y),(x + = y),(x * = y)一样工作...但是在Visual Studio 2019中,它的工作原理像(x =-y),(x = + y ),错误,错误…

错误代码:CS0193

说明:*或->运算符必须应用于指针。

c# assignment-operator visual-studio-2019

1
推荐指数
1
解决办法
78
查看次数