Welcome Login

Error: Expected class, delegate, enum, interface, or struct


Visual Studio

Eg:

vs-getmd5error1

 

Above code will cause the compiler to underline the string return part of the method in red with error 'Expected class, delegate, enum, interface, or struct'.

 

Reason:

Method definitions need to go into a class/struct definition. Method definitions can't appear outside a class.

To fix, put the GetMD5 method inside the Utility class!


Created on: Tuesday, November 8, 2011 by Andrew Sin