Error message

  • Thread starter Thread starter Scott
  • Start date Start date
S

Scott

Class, struct, or interface method must have a return type

i have only been working on ASP.NET and C# for about a month and this
is the first time i have come across this error message and the WROK
book im working from has nothing about it in it
 
Hi Scott,

I suspect you forgot to mention the return type :P

Note, class constructors are the only methods that do not have a return
type.

class MyClass
{
public MyClass() // no return type
{
}

// return type is void which means nothing returned
public void DoSomething()
{
}

public string DoSomethingElse() // return type is string
{
}
}

Happy coding!
Morten Wennevik [C# MVP]
 
Back
Top