Skip to main content

Func, Action, Predicate and Delegates

  • Func, Action, Predicate and Delegates

  • Delegate

    • é um ponteiro para uma função
    • Abaixo estão os 3 tipos de delegates
      • Func
        • Pega um input e retorna uma saída genérica
      • Action
        • Pega um input genérico e retorna nothing
      • Predicate
        • Pega um input genérico e sempre retorna o tipo boolean
    • Following LINQ methods uses delegates:
      • .Select method takes Func
      • .ForEach method takes an Action
      • .FindAll method takes a Predicate

1694412402954.jpg