Get the string "System.Collections.ObjectModel.ObservableCollection" from a Type (System.type) containing a generic ObservableCollection?

Posted by Guillaume Cogranne on Stack Overflow See other posts from Stack Overflow or by Guillaume Cogranne
Published on 2011-12-01T09:47:11Z Indexed on 2011/12/01 9:51 UTC
Read the original article Hit count: 211

Filed under:
|

I got a Type whose FullName is (if this helps) :

"System.Collections.ObjectModel.ObservableCollection`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"

From that Type, I'd like to get "System.Collections.ObjectModel.ObservableCollection" as a string but I'd like to do it "cleanly", which means, without spliting the string with the char '`'. I think the strategy is to get something like a Type or something else whose FullName will be "System.Collections.ObjectModel.ObservableCollection" but I really don't manage to do it :/

© Stack Overflow or respective owner

Related posts about c#

Related posts about observablecollection