Not sure, but one thing that comes to mind is that it is in serious need of
refactoring and documentation.
private const int XYZRANGE_LOW = 20;
private const int XYZRANGE_HIGH = 30;
/// <summary>
/// Validates that the provided arguments are within XYZ range.
/// If <see cref="reqFlag" /is <code>false</code>, the returned value will
always be false.
/// </summary>
/// <param name="argInRange">Value to verify as being within XYZ
range.</param>
/// <param name="reqFlag">Flag to determine whether validation returns
/// <code>true</codeif validation passes.</param>
/// <returns>Boolean result of validation.</returns>
private bool ValidateForXyz(int argInRange, bool reqFlag)
{
return reqFlag && (argInRange >= XYZRANGE_LOW
&& argInRange < XYZRANGE_HIGH);
}
Jon
"Jason Kid" <Ja******@microsoft.comwrote in message
news:Os**************@TK2MSFTNGP04.phx.gbl...
Hi,
Please tell me what's wrong with the following code.
private bool CheckIt( int iArg, bool fArg)
{
bool fIsGood = false;
bool fIsRight;
for (int i = 20; i < 30; i++ )
{
if (i == iArg)
fIsGood = true;
}
if (fArg == true)
fIsRight = true;
else
fIsRight = false;
if (fIsGood == true && fIsRight == true)
return true;
else
return false;
}