2

I am very new to C# as I have only started studying it in University in the last month so it is all very new to me. Coming over from C++ I am very out of place. When creating a new class I keep running into these same errors in visual studio. After typing

public int Credit(balance)

It won't automatically generate my {} and it un-indents my code? Any ideas?

Screenshot of the issue is here

2
  • 2
    remove the semicolon from the method signature Sep 27, 2018 at 16:12
  • 2
    Please post code, not images. Sep 27, 2018 at 16:31

2 Answers 2

4

You are missing the parameter type on your parameter. A valid line would be:

public int Credit(int balance)

The invalid method declaration is probably why the extra help doesn't kick in.

0
1

You didnt define the type of balance, for example

public int Credit(int balance)

I'm sure you have to do this in c++ too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy