本文整理汇总了C#中IDeclaredElement.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IDeclaredElement.GetType方法的具体用法?C# IDeclaredElement.GetType怎么用?C# IDeclaredElement.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDeclaredElement
的用法示例。
在下文中一共展示了IDeclaredElement.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnexpectedReferenceTypeException
public UnexpectedReferenceTypeException(IDeclaredElement declaredElement, ReferenceExpressionEater eater, ICSharpTreeNode node)
: base(string.Format("Unexpected reference declared type. Expected field, property, event, constant, variable or class, but was [{0}]", declaredElement.GetType()), eater, node)
{
DeclaredElement = declaredElement;
}
示例2: GetModule
private IModule GetModule(IDeclaredElement declaredElement)
{
#if RESHARPER_31 || RESHARPER_40 || RESHARPER_41
return declaredElement.Module;
#elif RESHARPER_60_OR_NEWER
var sourceFiles = declaredElement.GetSourceFiles();
IPsiModule psiModule;
if (sourceFiles.Count == 0)
{
// HACK: there must be a better way of doing this
var propertyInfo = declaredElement.GetType().GetProperty("Module");
psiModule = (IPsiModule)propertyInfo.GetValue(declaredElement, null);
}
else
{
psiModule = sourceFiles[0].GetPsiModule();
}
return psiModule.ContainingProjectModule;
#else
return declaredElement.Module.ContainingProjectModule;
#endif
}