I have written a short code to check the equivalence of two scrambled string. but the code is not working as expected.
The code is given below.
        string firstString, secondString;
        Console.Write("Enter the First String: ");
        firstString = Console.ReadLine();
        Console.Write("Enter the 2nd   String: ");
        secondString = Console.ReadLine();
        char[] firstArray = firstString.ToArray();
        char[] secondArray = secondString.ToArray();           
        Array.Sort(firstArray);
        Array.Sort(secondArray);
        firstString = firstArray.ToString();
        secondString = secondArray.ToString();
        if(firstString == secondString)
        {
            Console.Write("Matched");
        }
        else 
            Console.Write("Not Matched");            
            Console.ReadKey();                        
    }        
}
 
    