Comparison of 2 values based on custom operator
public class FieldComparer&lt;TFieldValue&gt;
{
  protected FieldComparer()
  { }
}



The right way to prevent a type from being created and allowing only derived types to do it is... to use an abstract class. By making the FieldComparer abstract you won't need to hide the default constructor.

An example implementation could look like this where you have a private class DefaultFieldComparer that implements the FieldComparer:

public abstract class FieldComparer&lt;TFieldValue&gt;
{
    ..

    internal static FieldComparer&lt;TFieldValue&gt; Default { get; } = new DefaultFieldComparer();

    private class DefaultFieldComparer : FieldComparer&lt;TFieldValue&gt; { }
}


I find this is a cleaner solution becasue it informs me that the FieldComparer is a base class and intended be subclassed becasue on its own it has no use but if it has, then it should be instantiable.




private readonly Dictionary&lt;string, Regex&gt; myRegexes = new Dictionary&lt;string, Regex&gt;();

private Regex GetRegex(string left)
{
  Regex regex;
  if (!myRegexes.TryGetValue(left, out regex))
  {
      regex = new Regex(left, RegexOptions.Compiled | RegexOptions.IgnoreCase);
      myRegexes.Add(left, regex);
  }
  return regex;
}



I'm not sure whether it's really necessary to use a dictionary for the regexes. In most cases the static Regex.IsMatch is sufficient and it already does the caching thing:


  The static IsMatch(String, String) method is equivalent to constructing a Regex object with the regular expression pattern specified by pattern and calling the IsMatch(String) instance method. This regular expression pattern is cached for rapid retrieval by the regular expression engine.