Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6057065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:26:49+00:00 2026-05-23T08:26:49+00:00

I have a Func<Foo, object> and Action<object> and would like to combine these into

  • 0

I have a Func<Foo, object> and Action<object> and would like to combine these into Action<Foo>, which combines my Func and Action into one Action where the result of the Func is passed to the Action. Is there a straightforward way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:26:50+00:00Added an answer on May 23, 2026 at 8:26 am

    The most general method I can think of would be something like this:

    Action<T1> Combine<T1, T2>(Func<T1, T2> func, Action<T2> action)
    {
        return x => action(func(x));
    }
    

    Usage:

    Func<Foo, object> func = x => x;
    Action<object> action = Console.WriteLine;
    
    Action<Foo> result = Combine(func, action);
    
    result(new Foo());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to combine a list of functions like so. I have this: Func<int,
I have method that looks something like ISomething<U> Foo<T, U>(Expression<Func<T, U>> selector) { Expression<Func<T,
Suppose we have: interface Foo { bool Func(int x); } class Bar: Foo {
Say I have a function func(i) that creates an object for an integer i,
I have a user control which takes a Func which it then gives to
Does python have a function like call_user_func() in PHP? PHP Version: call_user_func(array($object,$methodName),$parameters) How do
I have the following construct: type Foo struct { Bar func(foo *Foo) bool }
I have this compiled query: private static Func<DBContext, Foo> FooQuery = CompiledQuery.Compile<DBContext, Foo>( _db
I have a function that I would like to define in two different Perl
So, I have a class like this: class Test(object): def call(self,instruction,data): pass def handle_foo(self,data):

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.