This program shows how you can check if two given input strings are
Anagrams or not in CSharp language. Anagrams are two different words or combinations of characters which have the same
alphabets and their counts. Therefore a particular set of alphabets can
create many permutations of Anagrams. In other words, if we have the
same set of characters in two words(strings) then they are Anagrams.
We
create a function that has input as a character array pair of inputs. When we get the two different sets of characters, we check the count of each alphabet in these two sets. Finally, we tally and check if the value of character count for each alphabet is the same or not in these sets. If all characters occur at the same rate in both the sets of characters, then we declare the sets to be Anagrams otherwise not.
See the code below for C#: