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 918223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:20:20+00:00 2026-05-15T18:20:20+00:00

After using F# for a few small problems, I’ve found it helpful for myself

  • 0

After using F# for a few small problems, I’ve found it helpful for myself to think of C# extension methods as ‘a way of turning the . into a pipe-forward operator’.

For example, given a sequence of Int32s named ints, the C# code:

ints.Where(i => i > 0)
    .Select(i => i * i)

is similar to the F# code

let where = Seq.filter
let select = Seq.map

ints |> where (fun i -> i > 0)
     |> select (fun i -> i * i)

In fact, I often think of the extension methods on IEnumerable as simply a library of functions that provide similar functionality to F#’s Seq module.

Obviously the piped parameter is the last parameter in an F# function, but the first parameter in a C# extension method – but apart from that, are there any issues with using that explanation when describing extension methods or pipe-forward to other developers?

Would I be misleading them, or is it a helpful analogy?

  • 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-15T18:20:20+00:00Added an answer on May 15, 2026 at 6:20 pm

    I also think that this is a very useful analogy. In fact, I used exactly this analogy when describing the pipelining operator in my Real World Functional Programming book (which tries to explain functional ideas to people with C# background). Below is a quote from Chapter 6.

    Regarding the differences between the two – there are some conceptual differences (e.g. extension methods "add members to objects"), but I don’t think this has any impact on the way we use them in practice.

    • One notable practical difference between C# extension methods and F# functions is editor support – when you type "." in C#, you can see extension methods for the particular type. I believe that F# IntelliSense could show a filtered list when you type |> (in principle) as well, but it is probably much more work and it isn’t supported yet.

    • Both of the constructs are used to enable expression-based compositional programming style. By this I mean that you can write much larger portions of code as a single expression that describes what should be done (without extension methods/pipelining operator, you would probably break code into multiple stements). I think that this style of programming generally leads to a more declarative code.


    The pipelining operator (|>) allows us to write the first argument for a function on the left side; that is, before the function name itself. This is useful if we want to invoke a several processing functions on some value in sequence and we want to write the value that’s being processed first. Let’s look at an example, showing how to reverse a list in F# and then take its first element:

    List.hd(List.rev [1 .. 5])
    

    This isn’t very elegant, because the operations are written in opposite order then in which they are performed and the value that is being processed is on the right side, surrounded by several braces. Using extension methods in C#, we’d write:

    list.Reverse().Head();
    

    In F#, we can get the same result by using the pipelining operator:

    [1 .. 5] |> List.rev |> List.hd
    

    Even though, this may look tricky, the operator is in fact very simple. It has two arguments – the second one (on the right side) is a function and the first one (on the left side) is a value. The operator gives the value as an argument to the function and returns the result.

    In some senses, pipelining is similar to calling methods using dot-notation on an object, but it isn’t limited to intrinsic methods of an object. This is similar to extension methods, so when we write a C# alternative of an F# function that’s usually used with the pipelining operator, we’ll implement it as an extension method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After using a few validation libraries I finally decided to roll my own implementation,
I find that after running or debugging my application a few times using eclipse,
I am using eclipse galileo on my macbook pro. After a few minutes it
After using grep command, i will give you a small example grep test test
After taking some small courses and using WPF and C# a bit I've decided
I am having problems receiving response after using jQuery post. The script I am
I am writing a small console adventure game and I faced a few problems.
After using several non compatible barcode generators gems in rails 3.2, i am trying
After using the ebay API recently, I was expecting it to be as simple
After using PHP for a while now, I've noticed that not all built-in PHP

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.