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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:56:02+00:00 2026-05-23T16:56:02+00:00

I am replacing (part of) a Delphi COM library with a .net assembly. I

  • 0

I am replacing (part of) a Delphi COM library with a .net assembly. I have moved a number of the COM interfaces and enums to the .net assembly. Everything is fine except that the enums are exported to the type library using a {enum_type_name}_{enum_value_name} naming convention.

Example

[ComVisible(true)]
[Guid("318f9e87-444c-11d5-aed1-00105a758da4")]
public enum KeyIDEnum
{
    keLeft = 0,
    keCentre = 1,
    keRight = 2
}

Becomes

[
  uuid(318F9E87-444C-11D5-AED1-00105A758DA4),
  version(1.0)
]
typedef enum tagKeyIDEnum
{
  KeyIDEnum_keLeft = 0,
  KeyIDEnum_keCentre = 1,
  KeyIDEnum_keRight = 2
} KeyIDEnum;

I would like to know if there is any way to override this default behavior and specify the enum value names, possibly using an attribute. Something like:

[ComVisible(true)]
[Guid("318f9e87-444c-11d5-aed1-00105a758da4")]
public enum KeyIDEnum
{
    [Name("keLeft")]
    keLeft = 0,
    [Name("keCentre")]
    keCentre = 1,
    [Name("keRight")]
    keRight = 2
}

I’m almost certain there is a way to do this I just need to know which attribute class to use.

  • 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-23T16:56:03+00:00Added an answer on May 23, 2026 at 4:56 pm

    In short, I believe it can be done but it is not easy. I am almost certain an attribute will not do the trick as the MSDN page on exported type conversion talks about the prefixing but does not mention related attributes (whereas other parts of the page do). The listing of classes in System.Runtime.InteropServices (where COM-related attributes live) also does not have any attributes that appear promising.

    Finally, a blog post by Mauricio Rojas describes how to do it by modifying the IDL but it looks ugly. (A few other blogs have similar descriptions.)

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

Sidebar

Related Questions

What is the nicest way of replacing the host-part of an Uri using .NET?
I have everything working from the tutorial, replacing it with my data, but it
We are looking at replacing a proprietary calendar control. I've looked at scal http://scal.fieldguidetoprogrammers.com
I'm writing a sed script part of which requires replacing characters from a certain
I'm replacing an in house built application with a new (in house) application. Part
I have just optimised some Ruby code that was in a controller method, replacing
Below is part of the jquery code I have which displays the file input
I have a custom web part which is generating some user data. I have
We are replacing an old classic asp website with a .NET 3.5 solution. We
Is it valid to have an Interface as part of a sequence diagram. For

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.