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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:45:11+00:00 2026-05-13T11:45:11+00:00

I need to support a method named ‘send-request’ as an extension function to be

  • 0

I need to support a method named ‘send-request’ as an extension function to be used in an XSLT transformation. This is provided by an extension object on XslCompiledTransform. The cool thing about extension objects vs. <msxsl:script> is, well, that I don’t have to use <msxsl:script>, you just declare the namespace and call the function. The bad thing is that the function name must match exactly the CIL method name.

So, I’m wondering, is there a .NET language that supports hyphens in method names ? CLS compliance is not required, the method is invoked using reflection.

Or, can I use some technique that modifies the IL of an assembly to change the method name ?

Or, is there a way to intercept the reflection GetMethod call and trick the caller that a method ‘send-request’ exists, but return a ‘SendRequest’ method instead ?

  • 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-13T11:45:11+00:00Added an answer on May 13, 2026 at 11:45 am

    You can do this using reflection.

    I compiled the following into an assembly using ILAsm (I cut out all the fluff necessary to make this actually compile; these are just the salient bits (pun intended)):

    .method private hidebysig static int32 
    'Te-st'() cil managed {
        // Code size       8 (0x8)
        .maxstack  1
        .locals init ([0] int32 CS$1$0000)
        IL_0000:  nop
        IL_0001:  ldc.i4.s 0x11
        IL_0002:  stloc.0
        IL_0003:  br.s       IL_0005
    
        IL_0005:  ldloc.0
        IL_0006:  ret
    }
    

    I defined this method in a class named Program in a namespace named Test. Note that the method name is surrounded by single quotes. This is per the spec (ECMA #335):

    Identifiers are used to name entities. Simple identifiers are equivalent to an ID. However, the ILAsm syntax
    allows the use of any identifier that can be formed using the Unicode character set (see Partition I). To achieve
    this, an identifier shall be placed within single quotation marks.

    Then:

    var assembly = Assembly.LoadFrom(path);
    var method = assembly.GetType("Test.Program")
                         .GetMethod(
                             "Te-st",
                             BindingFlags.Static | BindingFlags.NonPublic
                 );
    Console.WriteLine(method.Invoke(null, null));
    

    This produced output:

    17
    

    I doubt that is the possible in the usual .NET languages. I don’t know of any languages that allow/require you to “escape” identifiers. Without that, could you imagine trying to disambiguate the following:

    int a;
    int b;
    int a-b;
    int diff = a-b; // is that a minus b or the variable a-b?
    

    Maybe there’s a COBOL.NET where you could do this, I don’t know.

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

Sidebar

Ask A Question

Stats

  • Questions 312k
  • Answers 312k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Well, this works: using System; using System.Configuration; using System.IO; using… May 13, 2026 at 10:37 pm
  • Editorial Team
    Editorial Team added an answer LINQ to objects for this scenario? You can do a… May 13, 2026 at 10:37 pm
  • Editorial Team
    Editorial Team added an answer "GPL-compatible" only matters if you're writing GPLed or LGPLed code.… May 13, 2026 at 10:37 pm

Related Questions

I have a class that I wish to expose as a remote service using
Say you have an app, that you want to provide users ability to browse
I've got some library code that works on a range of .NET runtimes (regular,
I've run into a bit of a problem, which I simply cannot find a
I have a listview with 4 columns - Name, Extension, Size and Location. I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.