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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:42:37+00:00 2026-05-13T08:42:37+00:00

I’ve got to allow users an easy way to identify a type in an

  • 0

I’ve got to allow users an easy way to identify a type in an assembly, then get the corresponding Type object.

I could, hypothetically, require they give me an assembly qualified name, but its a bit klunky, and can be hard to figure out if the assembly is signed. It would be easier on my part, however, as I could use Type.GetType(string) to get my type object.

If I allow my users to provide me a namespace-qualified type name (Namespace.Type), I cannot use Type.GetType to find my type object. Which leads me to my question.

As far as I know, the only way to do this is to spelunk through the current AppDomain (assuming the type’s assembly is loaded–which in my case will be true), and search through all the assemblies and their types for matching names (Type.FullName). Since the app domain has over 80 assemblies loaded with thousands of types defined, this can cause some delay in the UI (I’m doing this within an IValueConverter).

To mitigate this, I use a list of well known assembly public key tokens to weed out all the assemblies I know that will be loaded and will not contain the types I’m looking for. This solution is moderately successful.

My question is, are there faster, better ways that I can use to find a Type in the current AppDomain that matches a string containing its FullName?

Here’s my current code:

private static string[] wellKnownTokens = new string[] { 
    "b03f5f7f11d50a3a", 
    "4fe470e63e2d354f", 
    "b77a5c561934e089", 
    "31bf3856ad364e35" };

private Type GetTypeFromFullName(string fullName)
{    
    var assys = from x in AppDomain.CurrentDomain.GetAssemblies()
                where !wellKnownTokens.Any(y => x.FullName.EndsWith(y))
                select x;

    return (from x in assys.SelectMany(x => x.GetTypes())
                where x.FullName == typeName
                select x).FirstOrDefault();
}
  • 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-13T08:42:38+00:00Added an answer on May 13, 2026 at 8:42 am

    One approach would be to go through each assembly that is loaded (your 80 assemblies), and for each one append the assembly name to the type name (i.e. make the type name assembly qualififed) and then use Type.GetType(string, boolean) [make sure the boolean throwOnError
    is false]

    Without looking at the implementation of Type.GetType(string, boolean), I don’t know whether this would end up being faster than looping through all types in all assemblies or not.

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

Sidebar

Related Questions

i got an object with contents of html markup in it, for example: string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.