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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:24:28+00:00 2026-06-06T00:24:28+00:00

I am newbie to C#, and have a problem with understanding how should I

  • 0

I am newbie to C#, and have a problem with understanding how should I implement an extension method of interface. I didn’t found any material about this issue. From the material I found about general extension methods in C# I expected the following simple demonstrating example work:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace testExtension
{
public  interface  IcheckThingsOut
{
   bool x();
}
public static class extensionInterface
{
   public static bool y(this IcheckThingsOut bla) { return true;}
}
public class implementInteface : IcheckThingsOut
{
   bool IcheckThingsOut.x()
   {
       return true;
   }
   bool IcheckThingsOut.y()
   {
       return false;

   }
}
}

But the compiler is still not satisfied. What did I miss, and what is the right syntax here (with the same semantics as the code)?

  • 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-06-06T00:24:29+00:00Added an answer on June 6, 2026 at 12:24 am

    You have messed up the concepts of extension methods and interfaces. Extension methods are just a compiler convenient way of calling static methods on static classes. They do not extend the interface. What the compiler does when using an extensions method is:

      IcheckThingsOut instance = new IcheckThingsOutImpl();
      instance.y();
    

    … will be converted to:

      IcheckThingsOut instance = new IcheckThingsOutImpl();
      extensionInterface(instance, y);
    

    So as you can see, y is not a method on your interface. This is why you can’t implement it explicitly in the implementation.

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

Sidebar

Related Questions

Im newbie here.I have a problem with codeigniter segment() method.I referred 6th segment of
I am a Python newbie. I have this small problem. I want to print
I seem to have similar problem as this guy: Django newbie deployment question -
hey all.i'm newbie at this problem.i have this data in table result: item range_code
I have a problem with position of a block (div). I am newbie in
i am a newbie C# Programmer. I have a problem in xhtml. I want
I'm a newbie in java and I have a small problem. I want to
I'm a newbie in bash scripts and have the following problem : I'm trying
I have a little newbie problem that I cannot figure out, I am having
Newbie here! My problem is as follows: I have a dynamically populating ul where

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.