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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:23:21+00:00 2026-05-13T19:23:21+00:00

Consider the following code (C# 4.0): public class Foo : LambdaExpression { } This

  • 0

Consider the following code (C# 4.0):

public class Foo : LambdaExpression { }

This throws the following design-time error:

Foo does not implement inherited abstract member
System.Linq.Expressions.LambdaExpression.Accept(System.Linq.Expressions.Compiler.StackSpiller)

There’s absolutely no problem with public class Foo : Expression { } but, out of curiosity and for the sake of learning, I’ve searched in Google System.Linq.Expressions.LambdaExpression.Accept(System.Linq.Expressions.Compiler.StackSpiller) and guess what: zero results returned (when was the last time you saw that?). Needless to say, I haven’t found any documentation on this method anywhere else.

As I said, one can easily inherit from Expression; on the other hand LambdaExpression, while not marked as sealed (Expression<TDelegate> inherits from it), seems to be designed to prevent inheriting from it. Is this actually the case? Does anyone out there know what this method is about?

EDIT (1): More info based on the first answers – If you try to implement Accept, the editor (C# 2010 Express) automatically gives you the following stub:

protected override Expression Accept(System.Linq.Expressions.ExpressionVisitor visitor)
{
    return base.Accept(visitor);
}

But you still get the same error. If you try to use a parameter of type StackSpiller directly, the compiler throws a different error: System.Linq.Expressions.Compiler.StackSpiller is inaccessible due to its protection level.

EDIT (2): Based on other answers, inheriting from LambdaExpression is not possible so the question as to whether or not it is recommended becomes irrelevant. I wonder if, in cases like this, the error message should be Foo cannot implement inherited abstract member System.Linq.Expressions.LambdaExpression.Accept(System.Linq.Expressions.Compiler.StackSpiller) because [reasons go here]; the current error message (as some answers prove) seems to tell me that all I need to do is implement Accept (which I can’t do).

  • 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-13T19:23:22+00:00Added an answer on May 13, 2026 at 7:23 pm

    I just looked at the LambdaExpression class in .NET 3.5 using Reflector and the class has only an internal constructor. When I try your code, I’m getting an error “The type ‘System.Linq.Expressions. LambdaExpression’ has no constructors defined”, so on .NET 3.5 this cannot be done (leaving aside the question whether it would be useful to do it).

    In .NET 4.0 it behaves as you described. However, the Accept method is internal and so is the StackSpiller type. This again means that you simply can’t do this (although it isn’t clear from the compiler error message). It is worth noting that the class still has only internal constructor on .NET 4.0. The compiler only finds another reason why you can’t override it (and doesn’t worry about that any more).

    EDIT: Regarding the StackSpiller type – it is internal, so you don’t really need to worry about it. However, it looks that the type comes from DLR, which is a .NET 4.0 component that now handles compilation of lambda expressions (and also C# 4 dynamic). Anyway, DLR is open-source, so here is what a summary comment says about this type:

    Expression rewriting to spill the CLR stack into temporary variables
    in order to guarantee some properties of code generation, for
    example that we always enter try block on empty stack.

    This means that it is used to do some pre-processing of lambda expressions when they are compiled using the Compile method. You can get the source code from CodePlex.

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

Sidebar

Ask A Question

Stats

  • Questions 310k
  • Answers 310k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try this : findViewById(R.id.btnEnvoyer).setOnClickListener( new Button.OnClickListener() { public void onClick(View… May 13, 2026 at 10:15 pm
  • Editorial Team
    Editorial Team added an answer Use the function MultiByteToWideChar. Sample code: std::string toStdString(const std::wstring& s,… May 13, 2026 at 10:15 pm
  • Editorial Team
    Editorial Team added an answer I solved in this way: var alphaOrder = defaultOrder.clone(); and… May 13, 2026 at 10:15 pm

Related Questions

Let's consider the following enum in C# public enum ScrollMode : byte { None
Several comments on a recent answer of mine, What other useful casts can be
Possible Duplicate: Why isn’t sizeof for a struct equal to the sum of sizeof
Is there a defined behavior for how regular expressions should handle the capturing behavior
I am working on a function to establish the entropy of a distribution. It

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.