当前位置: 首页>>代码示例>>C#>>正文


C# IDeclaredElement.GetContainingType方法代码示例

本文整理汇总了C#中IDeclaredElement.GetContainingType方法的典型用法代码示例。如果您正苦于以下问题:C# IDeclaredElement.GetContainingType方法的具体用法?C# IDeclaredElement.GetContainingType怎么用?C# IDeclaredElement.GetContainingType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDeclaredElement的用法示例。


在下文中一共展示了IDeclaredElement.GetContainingType方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateContextSpecification

    public ContextSpecificationElement CreateContextSpecification(IDeclaredElement field)
    {
#if RESHARPER_6
      IClass clazz = ((ITypeMember)field).GetContainingType() as IClass;
#else
      IClass clazz = field.GetContainingType() as IClass;
#endif
      if (clazz == null)
      {
        return null;
      }

      ContextElement context;
      _cache.Classes.TryGetValue(clazz, out context);
      if (context == null)
      {
        return null;
      }

      return GetOrCreateContextSpecification(_provider,
                                             _project,
                                             context,
                                             _projectEnvoy,
#if RESHARPER_6
                                             clazz.GetClrName().FullName,
#else
                                             clazz.CLRName,
#endif
                                             field.ShortName,
                                             clazz.GetTags(),
                                             field.IsIgnored());
    }
开发者ID:ChrisEdwards,项目名称:machine.specifications,代码行数:32,代码来源:ContextSpecificationFactory.cs

示例2: CreateBehavior

    public BehaviorElement CreateBehavior(IDeclaredElement field)
    {
      IClass clazz = field.GetContainingType() as IClass;
      if (clazz == null)
      {
        return null;
      }

      ContextElement context;
      _cache.Classes.TryGetValue(clazz, out context);
      if (context == null)
      {
        return null;
      }

      string fullyQualifiedTypeName = null;
      if (field is ITypeOwner)
      {
          // Work around the difference in how the MetaData API and Psi API return different type strings for generics.
          TypeNameCache.TryGetValue(GetFirstGenericNormalizedTypeName(field), out fullyQualifiedTypeName);
      }

      return new BehaviorElement(_provider,
                                 context,
                                 _projectEnvoy,
                                 clazz.CLRName,
                                 field.ShortName,
                                 field.IsIgnored(),
                                 fullyQualifiedTypeName);
    }
开发者ID:noronha1978,项目名称:machine.specifications,代码行数:30,代码来源:BehaviorFactory.cs

示例3: CreateBehaviorSpecification

 BehaviorSpecificationElement CreateBehaviorSpecification(BehaviorElement behavior,
                                                          IDeclaredElement behaviorSpecification)
 {
   return new BehaviorSpecificationElement(_provider,
                                           behavior,
                                           _projectEnvoy,
                                           behaviorSpecification.GetContainingType().CLRName,
                                           behaviorSpecification.ShortName,
                                           behaviorSpecification.IsIgnored());
 }
开发者ID:smaclell,项目名称:machine.specifications,代码行数:10,代码来源:BehaviorSpecificationFactory.cs

示例4: CreateBehaviorSpecification

    BehaviorSpecificationElement CreateBehaviorSpecification(BehaviorElement behavior,
                                                             IDeclaredElement behaviorSpecification)
    {
      return new BehaviorSpecificationElement(_provider,
                                              behavior,
                                              _projectEnvoy,
#if RESHARPER_6
                                              behavior.FullyQualifiedTypeName ?? ((ITypeMember)behaviorSpecification).GetContainingType().GetClrName().FullName,
#else
                                              behavior.FullyQualifiedTypeName ?? behaviorSpecification.GetContainingType().CLRName,
#endif
 behaviorSpecification.ShortName,
                                              behaviorSpecification.IsIgnored());
    }
开发者ID:hhariri,项目名称:machine.specifications,代码行数:14,代码来源:BehaviorSpecificationFactory.cs

示例5: GetFullMethodName

        /// <summary>
        /// Gets the full name of the method.
        /// </summary>
        /// <param name="method">
        /// The method.
        /// </param>
        /// <returns>
        /// The get full method name.
        /// </returns>
        public static string GetFullMethodName(IDeclaredElement method)
        {
            var result = method.ShortName;

              var typeElement = method.GetContainingType();
              if (typeElement != null)
              {
            result = typeElement.ShortName + "." + result;

            var ns = typeElement.GetContainingNamespace();

            result = ns.QualifiedName + "." + result;
              }

              return result;
        }
开发者ID:xerxesb,项目名称:agentjohnsonplugin,代码行数:25,代码来源:Methods.cs

示例6: CreateBehavior

    public BehaviorElement CreateBehavior(IDeclaredElement field)
    {
#if RESHARPER_6
      IClass clazz = ((ITypeMember)field).GetContainingType() as IClass;
#else
      IClass clazz = field.GetContainingType() as IClass;
#endif
      if (clazz == null)
      {
        return null;
      }

      ContextElement context;
      _cache.Classes.TryGetValue(clazz, out context);
      if (context == null)
      {
        return null;
      }

      string fullyQualifiedTypeName = null;
      if (field is ITypeOwner)
      {
          // Work around the difference in how the MetaData API and Psi API return different type strings for generics.
          TypeNameCache.TryGetValue(GetFirstGenericNormalizedTypeName(field), out fullyQualifiedTypeName);
      }

      return GetOrCreateBehavior(_provider,
#if RESHARPER_61
                                 _manager, _psiModuleManager, _cacheManager, 
#endif
                                 _project,
                                 _projectEnvoy,
                                 context,
#if RESHARPER_6
                                 clazz.GetClrName().FullName,
#else
                                 clazz.CLRName,
#endif
                                 field.ShortName,
                                 field.IsIgnored(),
                                 fullyQualifiedTypeName);
    }
开发者ID:pkapakos,项目名称:machine.specifications,代码行数:42,代码来源:BehaviorFactory.cs

示例7: CreateContextSpecification

    public ContextSpecificationElement CreateContextSpecification(IDeclaredElement field)
    {
      IClass clazz = field.GetContainingType() as IClass;
      if (clazz == null)
      {
        return null;
      }

      ContextElement context = _cache.Classes[clazz];
      if (context == null)
      {
        return null;
      }

      return new ContextSpecificationElement(_provider,
                                             context,
                                             _project,
                                             clazz.CLRName,
                                             field.ShortName,
                                             field.IsIgnored());
    }
开发者ID:Jirapong,项目名称:machine.specifications,代码行数:21,代码来源:ContextSpecificationFactory.cs

示例8: CreateBehavior

        public BehaviorElement CreateBehavior(IDeclaredElement field)
        {
            IClass clazz = field.GetContainingType() as IClass;
              if (clazz == null)
              {
            return null;
              }

              ContextElement context = ContextCache.Classes[clazz];
              if (context == null)
              {
            return null;
              }

              return new BehaviorElement(_provider,
                                 context,
                                 _project,
                                 clazz.CLRName,
                                 field.ShortName,
                                 field.IsIgnored());
        }
开发者ID:simonlaroche,项目名称:machine,代码行数:21,代码来源:BehaviorFactory.cs

示例9: CreateContextSpecification

    public ContextSpecificationElement CreateContextSpecification(IDeclaredElement field)
    {
      IClass clazz = field.GetContainingType() as IClass;
      if (clazz == null)
      {
        return null;
      }

      ContextElement context;
      _cache.Classes.TryGetValue(clazz, out context);
      if (context == null)
      {
        return null;
      }

      return new ContextSpecificationElement(_provider,
                                             context,
                                             _projectEnvoy,
                                             clazz.CLRName,
                                             field.ShortName,
                                             clazz.GetTags(),
                                             field.IsIgnored());
    }
开发者ID:stgwilli,项目名称:machine.specifications,代码行数:23,代码来源:ContextSpecificationFactory.cs

示例10: IsInSpecificationContainer

 /// <summary>
 /// Determines if the declared element is contained in a MSpec-related container type,
 /// i.e.: Context, context base class, class with <see cref="BehaviorsAttribute" />.
 /// </summary>
 static bool IsInSpecificationContainer(IDeclaredElement declaredElement)
 {
   var containingType = declaredElement.GetContainingType();
   return IsContext(containingType) || containingType.IsBehaviorContainer() || IsContextBase(containingType);
 }
开发者ID:jayhill,项目名称:machine.specifications,代码行数:9,代码来源:MSpecElementNaming.cs

示例11: IsInSpecificationContainer

    /// <summary>
    /// Determines if the declared element is contained in a MSpec-related container type,
    /// i.e.: Context, context base class, class with <see cref="BehaviorsAttribute" />.
    /// </summary>
    static bool IsInSpecificationContainer(IDeclaredElement declaredElement)
    {
#if RESHARPER_6
      ITypeElement containingType = null;
      if (declaredElement is ITypeMember)
        containingType = ((ITypeMember) declaredElement).GetContainingType();
      else if (declaredElement is ITypeElement)
        containingType = (ITypeElement) declaredElement;
#else
      var containingType = declaredElement.GetContainingType();
#endif
      return IsContext(containingType) || containingType.IsBehaviorContainer() || IsContextBase(containingType);
    }
开发者ID:nachojammers,项目名称:machine.specifications,代码行数:17,代码来源:MSpecElementNaming.cs

示例12: IsBehavior

 static bool IsBehavior(IDeclaredElement declaredElement)
 {
   return declaredElement.IsBehavior() && IsTestElement(declaredElement.GetContainingType());
 }
开发者ID:jagregory,项目名称:machine.specifications,代码行数:4,代码来源:MSpecElementNaming.cs

示例13: IsInTestElementOrContext

 static bool IsInTestElementOrContext(IDeclaredElement declaredElement)
 {
     return IsTestElement(declaredElement.GetContainingType()) || IsContextBase(declaredElement.GetContainingType());
 }
开发者ID:jagregory,项目名称:machine.specifications,代码行数:4,代码来源:MSpecElementNaming.cs

示例14: IsSupportingField

 static bool IsSupportingField(IDeclaredElement declaredElement)
 {
   return declaredElement.IsSupportingField() &&
          (IsTestElement(declaredElement.GetContainingType()) || IsContextBase(declaredElement.GetContainingType()));
 }
开发者ID:bmavity,项目名称:machine.specifications,代码行数:5,代码来源:MSpecElementNaming.cs


注:本文中的IDeclaredElement.GetContainingType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。