简体   繁体   English

检查对象的类型是否来自特定的命名空间

[英]Check if an object's type is from a particular namespace

Is it possible to check if the object's type is a part of a particular namespace from C# code? 是否可以从C#代码检查对象的类型是否是特定命名空间的一部分? If yes, how? 如果有,怎么样?

I need to check if e.OriginElement as FrameworkElement is one of the MS.Internal controls. 我需要检查e.OriginElement as FrameworkElementMS.Internal控件之一。

您可以检查Type.Namespace属性。

e.OriginElement.GetType().Namespace

e.OriginElement.GetType().Namespace

应该为您提供所需的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何检查对象是否不是特定类型? - How to check if an object is not of a particular type? 如何在Windows 8中的HashSet中检查特定类型的对象? - How to check for object of particular type in a HashSet in windows 8? C#XML序列化类型对象中没有名称空间的元素 - C# XML serialize elements from type object without namespace 错误反序列化类型的对象...结束元素'...'从命名空间''预期。 从命名空间''找到元素'item' - error deserializing the object of type … End element '…' from namespace '' expected. Found element 'item' from namespace '' 找不到类型或命名空间,但它就在那里 - Type or namespace could not be found, but it's there 从抽象类型对象数组中访问特定子类的对象 - Accessing an object of a particular sub class from an array of abstract type objects 从现有对象的类型创建对象? - Create an object from an existing object's type? 动态更改对象的命名空间 - Change the object's namespace dynamically 检查类型是否属于没有硬编码字符串的命名空间 - Check if a type belongs to a namespace without hardcoded strings 如何检查对象中是否具有特定类型的特定方法/属性? - How to check whether an object has certain method/property of particular type within it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM