Connecting Tech Pros Worldwide Forums | Help | Site Map

ToUpper() Not working

Shrinivas Reddy
Guest
 
Posts: n/a
#1: Nov 16 '05
Hi,

I am using the ToUpper() function in an FXCop rule which checks whether a
boolean variable has "is" or "has" as the prefix. The ToUpper() function does
not work.
When I put the expression field.Name.Name.ToUpper() in Watch or Command
Window I get the error "error: 'field.Name.Name.ToUpper' does not exist" but
when I print the result using
Debug.WriteLine(field.Name.Name.ToUpper()) it works fine.

The code is

public override Problem[] Check(Field field)
{


if (field.Type.GetRuntimeType().UnderlyingSystemType is System.Boolean &&
(!(field.Name.Name.ToUpper().StartsWith("IS")) |
!(field.Name.Name.ToUpper().StartsWith("HAS"))))
{
string[] args = new string[1] {field.Name.ToString()};
base.Problems.Add(base.GetResolution(args), MessageLevel.Error, 95);
return base.Problems.AsArray();
}
else
{
return null;
}
}


Thanks
Shrinivas



Closed Thread