How to get Assembly from a Type object in UWP (aka

2019-04-18 19:34发布

The Type class has got an Assembly attribute in .NET Framework. However this attribute is gone when you are writing an UWP which is of course using .NET Core. Only the AssemblyQualifiedName attribute is available.

How can I get to the Assembly from this name?

Please bear in mind that lot of the usual classes are not available in .NET Core, so your usual .NET Framework answer might not work. E.g. there is no such thing as AppDomain, etc.

2条回答
我欲成王,谁敢阻挡
2楼-- · 2019-04-18 20:07

You can use typeof(xxx).GetTypeInfo().Assembly to get Assembly。

查看更多
爷、活的狠高调
3楼-- · 2019-04-18 20:13

Ok I have overlooked the TypeInfo class that is available using GetTypeInfo on a Type object. TypeInfo has got the Assembly property.

查看更多
登录 后发表回答