TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
C# Coding Standard
Search

Rule:  6@106Checked automatically with code checker

This rule is Obsolete
Synopsis:Finish every if-else-if statement with an else part
Language:C#
Severity Level:5
Category:Control flow


Description:
The intention of this rule, which applies to else-if constructs, is the same as in [6@105]. Consider the following example.

void Foo(string answer)
{
	if ("no" == answer)
	{
		Console.WriteLine("You answered with No");
	}
	else if ("yes" == answer)
	{
		Console.WriteLine("You answered with Yes");
	}
	else
	{
 		// This block is required, even though you might not care of any other
 		// answers than "yes" and "no". 
	}