The requested page is not available for the requested platform. You are viewing the content for Default platform.

Method must have a return type

CodeRush Classic shows the Method must have a return type code issue if a method does not have a return type.

Fix

Specify the return type for the method.

Purpose

Highlights the method declarations, which would cause the Method must have a return type compilation error.

Example

private OutputText(string text)
{
    Console.WriteLine(text);
}

Fix:

private void OutputText(string text)
{
    Console.WriteLine(text);
}