I clarify the question (apparently either I did not understand you, or you did me). Here are the parts of the program
private void FormLoad(object sender, EventArgs e) { m_MethodCombo.Items.AddRange(new[]{"MD5", "SHA1", "MD160"}); } private void CalcClick(object sender, EventArgs e) { var method = (string)m_MethodCombo.SelectedItem; HashAlgorithm alg; switch (method) { case "MD5" : alg = MD5.Create(); break; case "SHA1" : alg = SHA1.Create(); break; case "MD160": alg = RIPEMD160.Create(); break; default : throw new ApplicationException("Unknown hash method"); } m_OutputBox.Lines = m_InputBox .Lines .Select(line => ComputeHash(alg, line)) .ToArray(); } It can be seen that MD160 corresponds to the RIPEMD160 hash algorithm. It is required that by the element from the drop-down list (for example, MD160) determine the name of the hash of the algorithm (in this case RIPEMD160). That is, in my Algorithm class there will be a constructor to which the item of the drop-down list will be passed, and in the constructor, somehow the field HashAlgorithm of my Algorithm class will be initialized using this passed argument. The question is how to do it (as I see the solution: to search through all HashAlgorithms and get some name of the hash functions by them with some of their methods, but I don’t know how to save them and how to get their names for the hash functions functions)?
and so that you can go through all existing algorithms (I don’t know if the iterator is applicable here) and get the names of the corresponding functions and compare the names of these hash functions with the selected item from the drop-down list, that is, you cannot do without creating your own dictionary?