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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:54:01+00:00 2026-05-15T13:54:01+00:00

This simple class public class Test<T> { public static void A(Window wa, Window wb)

  • 0

This simple class

public class Test<T>
{
    public static void A(Window wa, Window wb)
    {
        wa.Closed += (s, e) => wb.Close();
    }
}

Gets compiled to this (I’m using Reflector to decompile) :

public class Test<T>
{
    [CompilerGenerated]
    private sealed class <>c__DisplayClass1
    {
        public Window wb;

        public void <A>b__0(object s, EventArgs e)
        {
            this.wb.Close();
        }
    }

    public static void A(Window wa, Window wb)
    {
        wa.Closed += delegate(object s, EventArgs e)
        {
            base.wb.Close();
        };
    }
}

What is the meaning of base ? Why is <>c__DisplayClass1 generated if it’s never used ?
Is this a Reflector bug ?

Edit:
Indeed, seems like Reflector optimisation isn’t woking very well in this case, disabling the optimisation the decompiled code makes sense :

public class Test<T>
{
    public Test()
    {
        base..ctor();
        return;
    }

    public static void A(Window wa, Window wb)
    {
        <>c__DisplayClass1<T> CS$<>8__locals2;
        CS$<>8__locals2 = new <>c__DisplayClass1<T>();
        CS$<>8__locals2.wb = wb;
        wa.Closed += new EventHandler(CS$<>8__locals2.<A>b__0);
        return;
    }

    [CompilerGenerated]
    private sealed class <>c__DisplayClass1
    {
        // Fields
        public Window wb;

        public <>c__DisplayClass1()
        {
            base..ctor();
            return;
        }

        public void <A>b__0(object s, EventArgs e)
        {
            this.wb.Close();
            return;
        }
    }
}
  • 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-15T13:54:01+00:00Added an answer on May 15, 2026 at 1:54 pm

    Reflector is “optimising” the output to try to come up with what the C# might have looked like. I don’t know where the “base” bit is coming from, admittedly… but the generated class is definitely being used.

    Set the Reflector options to “unoptimised” and you’ll see something more like an IL to C# direct conversion. Or just switch to IL and read it directly, if you want a pretty raw view.

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

Sidebar

Related Questions

This is my simple program: public class Test { public static Object obj =
This is a simple program i wrote using for loop public class Test {
I have this simple test project just to test the IncludeExceptionDetailInFaults behavior. public class
take this simple code: class A{ public: virtual void foo() = 0; void x(){
Simple question, how make this code working ? public class T { public static
import java.lang.*; import java.io.*; class test { public static void main(String[] a) throws Exception
I have a really simple Java code: public class Main { public static void
I have a test sample about coherence lock-unlock mechanism like this: public class Test
I have this simple class public class Position{ int x; int y; Position(int x,int
Consider this simple AS3 class. package { import flash.display.Sprite; import flash.display.MovieClip; public class MySprite

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.