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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:31:03+00:00 2026-05-14T18:31:03+00:00

Is there a straighforward library that I can use to access the CIL for

  • 0

Is there a straighforward library that I can use to access the CIL for a .NET type? Let me demonstrate what I want the fictitious CilExtractor to do:

[Serializable]
public class Type_For_Extract_Cil_Test {

  private int _field = 3;

  public int Method(int value) {
    checked {
      return _field + value;
    }
  }

}

[Test]
public void Extract_Cil_For_Type_Test() {
  string actualCil = CilExtractor.ExtractCil(typeof(Type_For_Extract_Cil_Test));
  string expectedCil = @"
    .class public auto ansi serializable beforefieldinit Type_For_Extract_Cil_Test
      extends [mscorlib]System.Object
    {
      .method public hidebysig specialname rtspecialname instance void .ctor() cil managed
      {
        .maxstack 8
        ldarg.0 
        ldc.i4.3 
        stfld int32 Type_For_Extract_Cil_Test::_field
        ldarg.0 
        call instance void [mscorlib]System.Object::.ctor()
        ret 
      }

      .method public hidebysig instance int32 Method(int32 'value') cil managed
      {
        .maxstack 8
        ldarg.0 
        ldfld int32 Type_For_Extract_Cil_Test::_field
        ldarg.1 
        add.ovf 
        ret 
      }

      .field private int32 _field
    }";
  // indentations and code formatting issues apart, this should succeed
  Assert.AreEqual(expectedCil, actualCil);
}

I know I can do this with Mono.Cecil or Reflector, but I also know I have to write a lot of code to achieve this. Since Reflector already does this on its UI, isn’t there a simple way to access this functionality, like with a simple method call? Are there other libraries that are better suited to this specific scenario?

  • 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-14T18:31:04+00:00Added an answer on May 14, 2026 at 6:31 pm

    Well there is the ildasm.exe tool provided by the .NET framework and it can be used in a command-line environment to do the disassembly, it might be a good place to start.

    Here is the MSDN Documentation on the command-line options.

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

Sidebar

Related Questions

Let's say you have a class library project that has any number of supplemental
Are there any libraries for in-browser javascript that provide the same flexibility/modularity/ease of use
Straighforward question really Wondering if there was an application specific for handling coldfusion log
When writing a new jQuery plugin is there a straightforward way of checking that
I don't use Excel very often, but I'm hoping there is a fairly straightforward
I want to unit test a Java application that fetches mails from an email
I'm writing a small Ruby command-line application that uses fileutils from the standard library
I am interested in finding out if there exists a program or library which
There are many Web sites that include clickable maps that highlight regions on mouseover
I need to communicate with an XML-RPC server from a .NET 2.0 client. Can

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.