Problem with check method name

I wrote this code to check method′s name :

internalclassReglaNombreMetodo :BaseRule

{

public ReglaNombreMetodo()

:base("ReglaNombreMetodo"){}

publicoverrideTargetVisibilities TargetVisibility

{

get {returnTargetVisibilities.All; }

}

publicoverrideProblemCollection Check(Member member)

{

Method method = memberasMethod;

if (method ==null)

returnnull;

if (method.Name.Name.Length > 0)

{

if (!(char.IsUpper(method.Name.Name[0])))

{

Problems.Add(newProblem(newResolution("El nombre de la funcion debe empezar con Mayuscula"), method.Name.Name));

}

}

return Problems;

}

}

bui it doesn′t work. any ideas about what am I doing wrong?

[2845 byte] By [CinthiaJunguitu] at [2007-12-20]
# 1

Cinthia,

What isn't working? Where is the code you are trying to check? ie Is it in a web site project?

DavidM.Kean-MSFT at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Visual Studio Code Analysis and Code Metrics...
# 2

David,

Yes is in a web site ....I mean i want to check method′s name started with capital char....you have idea what return this sentence:

Method method = member as Method;

method.Name.Name[0] this code return the first letter of the method?

Thanks

CinthiaJunguitu at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Visual Studio Code Analysis and Code Metrics...
# 3

Cinthia,

Sorry, I'm confused. method.Name.Name[0] will return the first character of the name of the method. Is your rule's Check(Member) method getting called?

Is the class you are trying to check in the App_Code folder in the web site?

DavidM.Kean-MSFT at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Visual Studio Code Analysis and Code Metrics...
# 4

Cinthia,

Was this solved?

Regards

David

DavidM.Kean-MSFT at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Visual Studio Code Analysis and Code Metrics...
# 5

Thank you, but my problem now is I want to check if there is a sentence inside the try block..

CinthiaJunguitu at 2007-9-10 > top of Msdn Tech,Visual Studio Team System,Visual Studio Code Analysis and Code Metrics...

Visual Studio Team System

Site Classified