/// <returns>null for non-methods and alike</returns> public static TypeDefinition ContainingType(this IEntity @this) { TemplateDefinition scope = @this.EnclosingScope <TemplateDefinition>(); return(scope.IsType() ? scope.CastType() : null); }