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

  • Home
  • SEARCH
  • 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 9220585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:23:01+00:00 2026-06-18T03:23:01+00:00

Fiddler’s HTTPHeaders class has a member, Storage , which is a List<HTTPHeaderItem> . The

  • 0

Fiddler’s HTTPHeaders class has a member, Storage, which is a List<HTTPHeaderItem>.

The HTTPHeaders class exposes an enumerator in the .NET 1.1 style thusly: public System.Collections.IEnumerator GetEnumerator(). This method simply returns Storage.GetEnumerator().

Questions:

  1. Is there a performance penalty to not implementing IEnumerable<HTTPHeaderItem>? Or is the compilation of foreach(HTTPHeaderItem in oHTTPHeaders) smart enough to recognize that the object it got back also implements the type-specific version of IEnumerable and avoid a bunch of casting?

  2. Is it even possible to implement IEnumerable<HTTPHeaderItem> without hiding (via explicit interface implementation) the older GetEnumerator() method? Hiding the old method breaks binary compatibility with legacy extensions (e.g. Method not found: 'System.Collections.IEnumerator Fiddler.HTTPHeaders.GetEnumerator()‘.)

Outcome

*As noted by Servy’s answer below, there’s no simple way to avoid breaking binary compatibility when adding a public GetEnumerable() that returns a type-specialized Enumerator.

However, in my specific scenario, I got a bit lucky. HTTPHeaders is a base class and virtually all callers are using one of two derived classes (HTTPRequestHeaders and HTTPResponseHeaders). I’ve added public generic GetEnumerator() methods to both of the each of the derived classes. These new type-specific enumerators are called by code that is compiled against the new version, while older plugins that haven’t been recompiled still retrieve the non-generic Enumerator from the base class.*

  • 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-18T03:23:03+00:00Added an answer on June 18, 2026 at 3:23 am
    1. You need to provide some GetEnumerator method that returns the actual HTTPHeaderItem type for casting to be avoided. This means either implementing IEnumerable<HTTPHeaderItem> or having the one implicit GetEnumerator method return the actual type. In the general case, this means you can rely on Duck typing, and not implement IEnumerable<T>, but in your case, since such a method already exists with the wrong signature, that’s not possible.

    2. Sure. Just hide the IEnumerable<HTTPHeaderItem> implementation instead of the IEnumerable implementation. This is exactly what arrays do (to maintain binary compatibility).

    Here’s a simple example:

    public class Foo : IEnumerable, IEnumerable<HTTPHeaderItem>
    {
    
        public IEnumerator GetEnumerator()
        {
            throw new NotImplementedException();
        }
    
        IEnumerator<HTTPHeaderItem> IEnumerable<HTTPHeaderItem>.GetEnumerator()
        {
            throw new NotImplementedException();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use fiddler to call the method which is post. Here is my path:
I usually run Fiddler for net traffic monitoring and now am using a Mac
I am playing around with Fiddler to gather stats on how long a ASP.NET
Fiddler has many useful extensions . However, I can't find one that understands WCF's
I want to use fiddler with asp.net MVC 3 application to see when I
Fiddler Link : http://jsfiddle.net/nLxc4/5/ My code : <html> <head> <script type=text/javascript src=js/jquery-1.5.1.min.js></script> <script type=text/javascript>
I am using Fiddler to debug all HTTP request of my ASP.NET application. For
How could Fiddler show info which is different from what I see in debugger?
I have a crude header bar set up on fiddler: http://jsfiddle.net/bCJts/ It looks ok
In Fiddler, I can pass in a request and get a response 500. Fine

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.