You can use the following. It splits the string on the hyphen and removes any empty strings (due to multiple consecutive hyphens). It then joins the entries, after mapping each one to a string where the first letter is uppercase and the remainder is lower.
public static string ToClassName(string str)
{
var splits = str.Split('-', StringSplitOptions.RemoveEmptyEntries);
return string.Concat(splits.Select(s => char.ToUpper(s[0]) + (s.Length > 1 ? s.Substring(1).ToLower() : "")));
}
You may need to add the following:
using System.Linq;
Note that it does not validate the input which is trivial.