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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:15:42+00:00 2026-05-13T10:15:42+00:00

.NET 4.0 has that new Code Contracts feature. It works with interfaces too, as

  • 0

.NET 4.0 has that new Code Contracts feature. It works with interfaces too, as described here (scroll down to somewhere in the comments):

http://weblogs.asp.net/podwysocki/archive/2008/11/08/code-contracts-for-net-4-0-spec-comes-alive.aspx

Now my question is, can we use and abuse this “Default Interface Implementation Feature” by putting more custom code into those contract classes to achieve some MixIns functionality?

  • 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-13T10:15:42+00:00Added an answer on May 13, 2026 at 10:15 am

    I don’t think so. When defining code contracts for an interface, you can add a rela class that contains “requires” and “ensures” method calls that will be added to implementation methods, but the code rewriter will only run after the compiler has done its job (ie complaining that the interface method is not implemented by the class…)

    Might be abused to implement aspects, though 🙂

    Anyway, I don’t think the code rewriter would add anything else than requires and ensures method. And the code would not be added to the release assembly, only on the debug assembly.

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

Sidebar

Related Questions

I have an ASP.net website that has the following code: Random r = new
I'm developing an intranet webapp in asp.net that has a requirement for storing user
Suppose I have an MSI, that has .NET Framework as a pre-requisite. I know
We have a VB.Net application that has in the region of about 80 unique
I have a .NET assembly that has tens of classes and methods which are
I have a web application on ASP.NET (C#) that has some precompiled components. I've
I have inherited a reasonable sized ASP.net solution that has no automated tests. The
I need a listitem in my asp.net dropdownlist that has a value of 0
I am building a web application using ASP.NET MVC that has two very distinct
I have an ASP.NET MVC application that has one part where I dont really

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.