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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:57:31+00:00 2026-05-30T05:57:31+00:00

How do I get the class name/type using the class name string? like Dictionary<string,

  • 0

How do I get the class name/type using the class name string? like

Dictionary<string, string> DFields = GetFields();

the type is

Dictionary<string, string>
object = Deserialize<?>(_stream)

Ideally, I was thinking:

object = Deserialize<"Dictionary<string, string>">(_stream)

It should become

object = Deserialize<Dictionary<string, string>>(_stream) 

in order to work. Im serializing like 10 object but I only have the type names in string format. I need to format the string format to actual type so I can feed it to the generic serializer deserializer function.

  • 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-30T05:57:33+00:00Added an answer on May 30, 2026 at 5:57 am

    Step 1 – Get type instance:

    You need to use an assembly qualified name passed into Type.GetType().
    Doing a quick test by calling GetType().AssemblyQualifiedName on a Dictionary() type instance, it turns out to be:

    System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

    quite a mess. I believe you can remove most of it though and it’ll still work:

    System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.String, mscorlib]], mscorlib

    therefor:

    var typeName = "System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.String, mscorlib]], mscorlib";
    var type = Type.GetType( typeName );
    

    Step 2 (assuming the API forces a generic parameter which IMO is shit) – Use reflection to parametize the generic method dynamically:

    var genericMethod = typeof(Serialzier).GetMethod( "Deserializer" );
    var parametizedMethod = genericMethod.MakeGenericMethod( type );
    var parameters = new object[] { _stream };
    var deserializedInstance = parametizedMethod.Invoke( null, parameters );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following object: public class Product { string Name {get;} int Quantity {get;}
I want to get the class name using jQuery And if it has an
I'm looking for a way using jquery/javascript to get a class name when I
I've got two List<Name> s: public class Name { public string NameText {get;set;} public
I have a class like this, public class person { name Name {set; get;}
I've got this class: class Foo { public string Name { get; set; }
Consider the following class hierarchy: public class Foo { public string Name { get;
public class LearnerInfo { public string Id { get; set; } public string Name
I would like to create an instance of a specified class using its name.
My class is like this, public class Person : DynamicObject { public string Name

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.