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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:36:17+00:00 2026-05-22T18:36:17+00:00

Long time lurker, first time poster here. My question is: Using C# 2.0, is

  • 0

Long time lurker, first time poster here.

My question is:

Using C# 2.0, is there a way to associate am image with a class/type such that I don’t have to create an instance of the class just to get the image object from that class?

What I am trying to do is scan all the .dlls in my application and construct a list of classes and corresponding attributes. I have this working great, and now I want to somehow associate an image with each class so that I can display a list of classes and have a unique image for each.

I’ve tried searching SO and the internet for an answer, but can’t find anything definite. Any help would be greatly appreciated.

Thanks,

Kyle

  • 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-22T18:36:17+00:00Added an answer on May 22, 2026 at 6:36 pm

    Figured out how to do it using ideas here and there.

    1. Mark the image as an EmbeddedResource.

    2. Create an attribute for specifying the image name.

    3. Once the image name attribute is read, use the following to locate the image resource inside the assembly where the class was declared:

      string[] all = info.Type.Assembly.GetManifestResourceNames();
      
      foreach (string resourceStr in all)
      {
        if (!String.IsNullOrEmpty(resourceStr) && resourceStr.EndsWith(String.Format(".{0}", iconName), true, CultureInfo.CurrentCulture))
        {
          Stream file = info.Type.Assembly.GetManifestResourceStream(resourceStr);
      
          if (file != null)
          {
            info.Icon = Image.FromStream(file);
          }
        }
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Long term lurker, first time poster here. I have written a class to model
Long time lurker, first time poster. I'm making a ServerConnection module to make it
long time lurker, first question! I am struggling to optimize this query, which selects
First time poster, long time lurker :) I have a form setup that posts
This is my first post after being a long-time lurker - so please be
As a long-time lurker on SO, I'm popping my question cherry with a tricky
long time listener. First time caller... Not strictly a PHP question as it involves
Long time reader, first time poster asks: After many weeks of google and forum
This is my first post, have been a lurker for a long time, so
long-time listener, first-time caller! I’m trying to connect to MySQL using the ADO.NET Entity

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.