Examined how to create aliases system/user-defined types for parameters in the form of restrictions using a static delegate


You can create aliases (aliases, synonyms, types of the Russian language :) system / user-defined types for parameters in the form of constraints.

To do this in main() method of application we define static delegate EditAdvansedFilter1.TypeToString = …, with the following signature:

public delegate string TypeToStringDelegate(System.Type Type)

This delegate specifies the method that accepts the input .Net type (system / user) and returns its string representation for display. Method must return “null” if the type match is not found.

Example usage:

static void Main()
  EditAdvansedFilter1.TypeToString = MyStringViewForSpecificType;

private static string MyStringViewForSpecificType(Type type)
  if (type == typeof(string))
    return "string";

  if (type == typeof(Планета))
    return "Planetamazon";
  return null;