How to retrieve base class information of any child class in StyleCop+

Aug 8, 2012 at 1:09 PM

I want to implement following rule in StyleCop+.

Rule: Base class variable should not declare again in child class (Same variable name).

 

class A

{

                //Class level variable

                private string strA;

} 

Class B : A

{

                //Class level variable

                private string strA;

}

 

It should throw warning at class B level as “strA” variable declare again in child class B as it is already declare in base class A.

Basically i want to restrict user not to use same variable name as in base class. 

Do any one have idea how to achieve this rule?

Coordinator
Aug 8, 2012 at 3:17 PM
Can't be done with current parser.

You only see the current class not the base class.


~A.

On 8 Aug 2012, at 13:09, AnkushJ <notifications@codeplex.com> wrote:

From: AnkushJ

I want to implement following rule in StyleCop+.

Rule: Base class variable should not declare again in child class (Same variable name).

class A

{

//Class level variable

private string strA;

}

Class B : A

{

//Class level variable

private string strA;

}

It should throw warning at class B level as “strA” variable declare again in child class B as it is already declare in base class A.

Basically i want to restrict user not to use same variable name as in base class.

Do any one have idea how to achieve this rule?