Can an attribute in a static class and the name of a parameter be called equal?

0

I try to do the following;

     class StringRotation
        {
           private static char[] Primera = new char[256];
           private static char[] segunda = new char[256];
           public static int ShiftedDiff(string primera, string segunda)
             {
                 Primera = primera.ToCharArray();
                 segunda = segunda.ToCharArray();
                 return 0;
        }

The variable "second" is called the same as the parameter of the "ShiftedDiff" method, therefore, the compiler interprets that in the "second line = second.ToCharArray (); " is toy by referencing the same variable. I would like to use the "this." , as if it were a dynamic class but it is not possible, in these cases which style rules are used?

    
asked by Edulon 23.08.2017 в 10:57
source

1 answer

2

I guess the form would be this:

class StringRotation
    {
       private static char[] Primera = new char[256];
       private static char[] segunda = new char[256];
       public static int ShiftedDiff(string primera, string segunda)
         {
             StringRotation.Primera = primera.ToCharArray();
             StringRotation.segunda = segunda.ToCharArray();
             return 0;
    }

Try and comment if it worked for you.

    
answered by 23.08.2017 / 11:14
source