Comparing a selected attribute of a color with a given value I need to call different functions depending on which enum value is used as parameter.
it's working as it should do, but I wanted to ask if there's a proper way to do this without lacking a good performance?

public enum Comparator
{
   Greater=1,Equal=0,Lower=-1
}
public enum ComparableValues
{
    R,G,B,Yellow,Violett,Turquoise,Sum,Average,Intensity
}
public override bool Process(Color cl,Comparator Comp,ComparableValues SelectedValue,float Value)
{
    if (SelectedValue == ComparableValues.R)
    {
        return Value.CompareTo(cl.R) ==(int) Comp;
    }
    if (SelectedValue == ComparableValues.G)
    {
        return Value.CompareTo(cl.G) == (int)Comp;
    }
    if (SelectedValue == ComparableValues.B)
    {
        return Value.CompareTo(cl.B) == (int)Comp;
    }
    if (SelectedValue == ComparableValues.Average)
    {
        return Value.CompareTo(cl.Average()) == (int)Comp;
    }
    return Value.CompareTo(cl.Sum()) == (int)Comp;
}


I know that it could be done by a Function table, like this:

Dictionary&lt;Tuple&lt;ComparableValues, Comparator&gt;, Func&lt;Color, float, bool&gt;&gt; 


or by a Dictionary-in-Dictionary or a Dictionary with these ints enums merged to an int...

But obviously all these variants don't feel like they would be proper C#-state of the art stuff.
You can greatly improve it by staring with proper names.

The first enum is actaully a comparison type so name it like so:

public enum ComparisonType
{
    LowerThen = -1,
    Equal = 0,
    GreaterThen = 1,    
}


The second enum is a list of color properties but you are allowed to use only one property at a time so your enum should not have a plural name. Let it be ColorProperty:

public enum ColorProperty
{
    R, G, B, Yellow, Violett, Turquoise, Sum, Average, Intensity
}


Calling your methods simply Process isn't good because it doesn't tell the user anything about what it does. Virtually every method processes something so the current name is too general. Think for a while... what does it do? It compares properties of a color with some value so how about IsProperty? Ok, but where is the color part? It's not necessary because will make it an extension of the color so the usage will be clear when used in context.

After applying these changes your method should look like this:

public static bool IsProperty(this Color color, ColorProperty colorProperty, ComparisonType comparisonType, float value)
{
    var colorPropertyGetters = new Dictionary&lt;ColorProperty, Func&lt;Color, int&gt;&gt;
    {
        [Color.R] = c =&gt; c.R,
        // ...
        [Color.Average] = c =&gt; c.Average(),
    };

    return value.CompareTo(colorPropertyGetters[colorProperty](color)) == (int)comparisonType;    
}


Notice that I've also removed all the ifs and replaced them with a dictionary of Funcs that get the property to be comapared.

Now when you use it with a color there is no doubt what is going on here:

var result = color.IsProperty(ColorProperty.Yellow, ComparisonType.Equal, 5);


or

var result = color.IsProperty(ColorProperty.Average, ComparisonType.GreaterThen, 90);


Adjusting the arguments to be in a very specific order and the names for the enum values make the method call read very natural and similar to normal speech.