Click here to Skip to main content
13,085,123 members (57,502 online)
Click here to Skip to main content
Add your own
alternative version


7 bookmarked
Posted 22 Jul 2013

AssemblyQualifiedName Parser

, 22 Jul 2013
Rate this:
Please Sign up or sign in to vote.
A parser for AssemblyQualifiedName for .NET

What Is It ?

ParsedAssemblyQualifiedName is a simple parser for type.AssemblyQualifiedName for .NET.

It is a fact that the syntax of AssemblyQualifiedName is rather complex. While I am working on a new version of UniversalSerializer, I need such a parser and I am unable to find one in the Internet. So here is a class that may help.


As I said, the syntax of AssemblyQualifiedName is rather complex, especially with generics.

An example:

Dictionary<int, List<double>>

has this AssemblyQualifiedName:

System.Collections.Generic.Dictionary`2[[System.Int32, mscorlib, Version=, 
  Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Collections.Generic.List`1[[System.Double, 
  mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, 
  Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, 
  Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089

Not very comprehensible!

ParsedAssemblyQualifiedName will extract these information:

mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089

System.Collections.Generic.Dictionary<System.Int32, System.Collections.Generic.List<System.Double>>




System.Collections.Generic.Dictionary`2[[System.Int32, mscorlib, 
  Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089],
  [System.Collections.Generic.List`1[[System.Double, mscorlib, Version=, 
  Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, 
  Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089]]

System.Collections.Generic.Dictionary(Of System.Int32, System.Collections.Generic.List(Of System.Double))
  • AssemblyDescriptionString: This is the assembly description part of the AssemblyQualifiedName.
  • AssemblyNameDescriptor: An AssemblyName generated from the AssemblyQualifiedName. It is Lazy.
  • CSharpStyleName: A C#-style type name. It is Lazy.
  • Culture: Culture string of the Assembly.
  • FoundType: Creates the Type corresponding to the AssemblyQualifiedName, if available. It is Lazy.
  • GenericParameters: Gets a list of ParsedAssemblyQualifiedName, one for each generic parameter. Obviously, it is recursive.
  • PublicKeyToken: The token of the Assembly.
  • ShortAssemblyName
  • TypeName: The first part of the AssemblyQualifiedName, without the Assembly information.
  • VBNetStyleName: A VB-style type name. It is Lazy.
  • Version: Version of the Assembly, as a string.


Please note ParsedAssemblyQualifiedName can analyse a type description even if the type does not exist or if it lays in an inaccessible library. In that case, only FoundType will not produce anything (it will return null).

Example of Usage

var parsed = new ParsedAssemblyQualifiedName
    (typeof(Dictionary<int, List<double>>).AssemblyQualifiedName);
var t = parsed.FoundType.Value;
var an = parsed.AssemblyNameDescriptor.Value;
var cs = parsed.CSharpStyleName.Value;
var vb = parsed.VBNetStyleName.Value;


I hope this small class will be useful to many. Future enhancements will be part of UniversalSerializer.


  • 2015-01-28 Correction for array types


This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


About the Author

Hi !

I made my first program on a Sinclair ZX-81.
Since that day, I have the virus of computers. Smile | :)

Some articles in my blog:

You may also be interested in...

Comments and Discussions

SuggestionA little improvement... Pin
Filippo Bottega17-Feb-15 3:58
memberFilippo Bottega17-Feb-15 3:58 
GeneralRe: A little improvement... Pin
Christophe Bertrand20-Feb-15 6:55
memberChristophe Bertrand20-Feb-15 6:55 
GeneralMy vote of 3 Pin
Member 1092263116-Jan-15 9:11
memberMember 1092263116-Jan-15 9:11 
AnswerRe: My vote of 3 Pin
Christophe Bertrand29-Jan-15 23:39
memberChristophe Bertrand29-Jan-15 23:39 
GeneralMy vote of 5 Pin
Member 767332830-Sep-13 17:10
memberMember 767332830-Sep-13 17:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.170813.1 | Last Updated 22 Jul 2013
Article Copyright 2013 by Christophe Bertrand
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid