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


C# IReturnType.GetUnderlyingClass方法代码示例

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


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

示例1: ProvideContextCompletion

		protected bool ProvideContextCompletion(ITextEditor editor, IReturnType expected, char charTyped)
		{
			if (expected == null) return false;
			IClass c = expected.GetUnderlyingClass();
			if (c == null) return false;
			if (c.ClassType == ClassType.Enum) {
				CtrlSpaceCompletionItemProvider cdp = new NRefactoryCtrlSpaceCompletionItemProvider(languageProperties);
				var ctrlSpaceList = cdp.GenerateCompletionList(editor);
				if (ctrlSpaceList == null) return false;
				ContextCompletionItemList contextList = new ContextCompletionItemList();
				contextList.Items.AddRange(ctrlSpaceList.Items);
				contextList.activationKey = charTyped;
				foreach (CodeCompletionItem item in contextList.Items.OfType<CodeCompletionItem>()) {
					IClass itemClass = item.Entity as IClass;
					if (itemClass != null && c.FullyQualifiedName == itemClass.FullyQualifiedName && c.TypeParameters.Count == itemClass.TypeParameters.Count) {
						contextList.SuggestedItem = item;
						break;
					}
				}
				if (contextList.SuggestedItem != null) {
					if (charTyped != ' ') contextList.InsertSpace = true;
					editor.ShowCompletionWindow(contextList);
					return true;
				}
			}
			return false;
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:27,代码来源:NRefactoryCodeCompletionBinding.cs

示例2: EventHandlerCompletitionDataProvider

		public EventHandlerCompletitionDataProvider(string expression, ResolveResult resolveResult)
		{
			this.expression = expression;
			this.resolveResult = resolveResult;
			this.resolvedReturnType = resolveResult.ResolvedType;
			this.resolvedClass = resolvedReturnType.GetUnderlyingClass();
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:7,代码来源:EventHandlerCompletitionDataProvider.cs

示例3: CreateFromBaseType

		/// <summary>
		/// Returns null if base type is not an interface.
		/// </summary>
		public static CodeInterface CreateFromBaseType(IProjectContent projectContent, IReturnType baseType)
		{
			IClass baseTypeClass = baseType.GetUnderlyingClass();
			if (baseTypeClass.ClassType == ClassType.Interface) {
				return new CodeInterface(projectContent, baseType, baseTypeClass);
			}
			return null;
		}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:11,代码来源:CodeInterface.cs

示例4: GetDelegateOrExpressionTreeSignature

 internal static IMethod GetDelegateOrExpressionTreeSignature(IReturnType rt, bool allowExpressionTree)
 {
     if (rt == null)
         return null;
     IClass c = rt.GetUnderlyingClass();
     if (allowExpressionTree && c != null && c.FullyQualifiedName == "System.Linq.Expressions.Expression") {
         ConstructedReturnType crt = rt.CastToConstructedReturnType();
         if (crt != null && crt.TypeArguments.Count == 1) {
             // get delegate type from expression type
             rt = crt.TypeArguments[0];
             c = rt != null ? rt.GetUnderlyingClass() : null;
         }
     }
     if (c != null && c.ClassType == ClassType.Delegate) {
         return rt.GetMethods().FirstOrDefault((IMethod m) => m.Name == "Invoke");
     }
     return null;
 }
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:18,代码来源:TypeInference.cs

示例5: CanCompareEqualityWithOperator

		static bool CanCompareEqualityWithOperator(IReturnType type)
		{
			// return true for value types except float and double
			// return false for reference types except string.
			IClass c = type.GetUnderlyingClass();
			return c != null
				&& c.FullyQualifiedName != "System.Single"
				&& c.FullyQualifiedName != "System.Double"
				&& (c.ClassType == Dom.ClassType.Struct
				    || c.ClassType == Dom.ClassType.Enum
				    || c.FullyQualifiedName == "System.String");
		}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:12,代码来源:OverrideEqualsGetHashCodeMethodsDialog.xaml.cs

示例6: Equals

		public static bool Equals(IReturnType rt1, IReturnType rt2)
		{
			if (rt1 == rt2) return true;
			if (rt1 == null || rt2 == null) return false;
			IClass c1 = rt1.GetUnderlyingClass();
			IClass c2 = rt2.GetUnderlyingClass();
			if (c1 == null && c2 == null) {
				// guess if the classes are equal
				return rt1.FullyQualifiedName == rt2.FullyQualifiedName && rt1.TypeArgumentCount == rt2.TypeArgumentCount;
			} else {
				if (c1 == c2)
					return true;
				if (c1 == null || c2 == null)
					return false;
				return c1.FullyQualifiedName == c2.FullyQualifiedName && c1.TypeParameters.Count == c2.TypeParameters.Count;
			}
		}
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:17,代码来源:DefaultReturnType.cs

示例7: IsAvailable

		public override bool IsAvailable(IReturnType parameterType)
		{
			var parameterTypeClass = parameterType.GetUnderlyingClass();
			return (parameterTypeClass == null || parameterTypeClass.ClassType != ClassType.Enum && parameterTypeClass.ClassType != ClassType.Struct);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:5,代码来源:ParamCheckForNull.cs

示例8: CreateFromBaseType

		public static CodeClass2 CreateFromBaseType(IProjectContent projectContent, IReturnType baseType)
		{
			IClass baseTypeClass = baseType.GetUnderlyingClass();
			return new CodeClass2(projectContent, baseTypeClass);
		}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:5,代码来源:CodeClass2.cs

示例9: GetContentPropertyName

		static string GetContentPropertyName(IReturnType type)
		{
			if (type == null)
				return string.Empty;
			
			IClass c = type.GetUnderlyingClass();
			
			if (c == null)
				return string.Empty;
			
			IAttribute contentProperty = c.Attributes
				.FirstOrDefault(attribute => attribute.AttributeType.FullyQualifiedName == "System.Windows.Markup.ContentPropertyAttribute");
			if (contentProperty != null) {
				return contentProperty.PositionalArguments.FirstOrDefault() as string
					?? (contentProperty.NamedArguments.ContainsKey("Name") ? contentProperty.NamedArguments["Name"] as string : string.Empty);
			}
			
			return string.Empty;
		}
开发者ID:Dervall,项目名称:SharpDevelop,代码行数:19,代码来源:CompletionDataHelper.cs

示例10: AllowsHelper

		static bool AllowsHelper(string baseClass, string methodName, IReturnType resolvedType, IProjectContent content)
		{
			IClass extensions = content.GetClass("System.Xml.Linq.Extensions", 0);
			if (extensions == null)
				return false;
			IMethod descendents = extensions.Methods.FirstOrDefault(m => m.Name == methodName);
			if (descendents == null)
				return false;
			IParameter param = descendents.Parameters.FirstOrDefault();
			if (param == null)
				return false;
			IClass resolvedTypeClass = resolvedType.GetUnderlyingClass();
			if (resolvedTypeClass == null)
				return false;
			return MemberLookupHelper.IsApplicable(resolvedType, param, descendents)
				|| resolvedTypeClass.IsTypeInInheritanceTree(content.GetClass(baseClass, 0));
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:17,代码来源:CompletionDataHelper.cs

示例11: ResolveMember

		bool ResolveMember(IReturnType type, string memberName)
		{
			ClearResult();
			if (type == null)
				return false;
			bool isClassInInheritanceTree = false;
			if (callingClass != null)
				isClassInInheritanceTree = callingClass.IsTypeInInheritanceTree(type.GetUnderlyingClass());
			foreach (IProperty p in type.GetProperties()) {
				if (IsSameName(p.Name, memberName)) {
					MakeResult(p);
					return true;
				}
			}
			foreach (IField f in type.GetFields()) {
				if (IsSameName(f.Name, memberName)) {
					MakeResult(f);
					return true;
				}
			}
			foreach (IEvent e in type.GetEvents()) {
				if (IsSameName(e.Name, memberName)) {
					MakeResult(e);
					return true;
				}
			}
			foreach (IMethod m in type.GetMethods()) {
				if (IsSameName(m.Name, memberName)) {
					MakeMethodResult(type, memberName);
					return true;
				}
			}
			if (callingClass != null) {
				List<IMethodOrProperty> list = new List<IMethodOrProperty>();
				ResolveResult.AddExtensions(callingClass.ProjectContent.Language, list.Add, callingClass, type);
				foreach (IMethodOrProperty mp in list) {
					if (IsSameName(mp.Name, memberName)) {
						if (mp is IMethod)
							MakeMethodResult(type, memberName);
						else
							MakeResult(mp);
						return true;
					}
				}
			}
			return false;
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:47,代码来源:ResolveVisitor.cs

示例12: ResolveMethodInType

		void ResolveMethodInType(IReturnType containingType, string methodName, ExpressionCollection arguments)
		{
			List<IMethod> methods = new List<IMethod>();
			bool isClassInInheritanceTree = false;
			if (callingClass != null)
				isClassInInheritanceTree = callingClass.IsTypeInInheritanceTree(containingType.GetUnderlyingClass());
			
			foreach (IMethod m in containingType.GetMethods()) {
				if (IsSameName(m.Name, methodName)
				    && m.IsAccessible(callingClass, isClassInInheritanceTree)
				   ) {
					methods.Add(m);
				}
			}
			if (methods.Count == 0) {
				List<IMethodOrProperty> list = new List<IMethodOrProperty>();
				ResolveResult.AddExtensions(callingClass.ProjectContent.Language, list.Add, callingClass, containingType);
				foreach (IMethodOrProperty mp in list) {
					if (IsSameName(mp.Name, methodName) && mp is IMethod) {
						IMethod m = (IMethod)mp.CreateSpecializedMember();
						m.Parameters.RemoveAt(0);
						methods.Add(m);
					}
				}
			}
			ResolveInvocation(methods, arguments);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:27,代码来源:ResolveVisitor.cs

示例13: IsResourceManager

        /// <summary>
        /// Determines if the specified type is a ResourceManager type that can
        /// be handled by this resolver.
        /// </summary>
        /// <param name="type">The type that will be checked if it is a ResourceManager.</param>
        /// <param name="sourceFileName">The name of the source code file where the reference to this type occurs.</param>
        static bool IsResourceManager(IReturnType type, string sourceFileName)
        {
            IProject p = ProjectFileDictionaryService.GetProjectForFile(sourceFileName);
            IProjectContent pc;
            if (p == null) {
                pc = ParserService.CurrentProjectContent;
            } else {
                pc = ResourceResolverService.GetProjectContent(p);
            }

            if (pc == null) {
                return false;
            }

            IClass c = type.GetUnderlyingClass();
            if (c == null) {
                return false;
            }

            IClass resourceManager = pc.GetClass("System.Resources.ResourceManager", 0);
            if (resourceManager == null) {
                return false;
            }

            return (c.CompareTo(resourceManager) == 0 || c.IsTypeInInheritanceTree(resourceManager));
        }
开发者ID:ichengzi,项目名称:SharpDevelop,代码行数:32,代码来源:BclNRefactoryResourceResolver.cs

示例14: IsReferenceType

		bool? IsReferenceType(IReturnType rt)
		{
			if (rt == null)
				return null;
			IClass c = rt.GetUnderlyingClass();
			if (c == null)
				return null;
			switch (c.ClassType) {
				case ClassType.Enum:
				case ClassType.Struct:
					return false;
				default:
					return true;
			}
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:15,代码来源:TypeInference.cs

示例15: AreTypesDifferent

		static bool AreTypesDifferent(IReturnType oldType, CodeTypeReference newType)
		{
			IClass oldClass = oldType.GetUnderlyingClass();
			if (oldClass == null) {
				// ignore type changes to untyped VB fields
				return false;
			}
			if (newType.BaseType == "System.Void") {
				// field types get replaced with System.Void if the type cannot be resolved
				// (e.g. generic fields in the Boo designer which aren't converted to CodeDom)
				// we'll ignore such type changes (fields should never have the type void)
				return false;
			}
			
			ArrayReturnType oldArray = oldType.IsArrayReturnType ? oldType.CastToArrayReturnType() : null;
			if (oldArray == null ^ newType.ArrayRank < 1)
			{
				return true;
			}
			
			if (oldArray == null) {
				
				if (oldClass.DotNetName != newType.BaseType) {
					return true;
				}
				
			} else {
				
				if (oldArray.ArrayDimensions != newType.ArrayRank) {
					return true;
				}
				if (AreTypesDifferent(oldArray.ArrayElementType, newType.ArrayElementType)) {
					return true;
				}
				
			}
			
			return false;
		}
开发者ID:TiberiuGal,项目名称:SharpDevelop,代码行数:39,代码来源:AbstractDesignerGenerator.cs


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