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


C# DomReturnType.ToInvariantString方法代码示例

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


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

示例1: HandleCodeCompletion


//.........这里部分代码省略.........
				string token = GetPreviousToken (ref tokenIndex, false);
				if (result.ExpressionContext == ExpressionContext.ObjectInitializer) {
					resolver = CreateResolver ();
					ExpressionContext exactContext = new NewCSharpExpressionFinder (dom).FindExactContextForObjectInitializer (textEditorData, resolver.Unit, Document.FileName, resolver.CallingType);
					IReturnType objectInitializer = ((ExpressionContext.TypeExpressionContext)exactContext).UnresolvedType;
					if (objectInitializer != null && objectInitializer.ArrayDimensions == 0 && objectInitializer.PointerNestingLevel == 0 && (token == "{" || token == ","))
						return CreateCtrlSpaceCompletionData (completionContext, result); 
				}
				if (token == "=") {
					int j = tokenIndex;
					string prevToken = GetPreviousToken (ref j, false);
					if (prevToken == "=" || prevToken == "+" || prevToken == "-") {
						token = prevToken + token;
						tokenIndex = j;
					}
				}
				switch (token) {
				case "=":
				case "==":
					result = FindExpression (dom, completionContext, tokenIndex - completionContext.TriggerOffset - 1);
					resolver = CreateResolver ();
					resolveResult = resolver.Resolve (result, location);
					if (resolveResult != null) {
						IType resolvedType = dom.GetType (resolveResult.ResolvedType);
						if (resolvedType == null) 
							return null;
						if (resolvedType.ClassType == ClassType.Enum) {
							CompletionDataList completionList = new ProjectDomCompletionDataList ();
							CompletionDataCollector cdc = new CompletionDataCollector (dom, completionList, Document.CompilationUnit, resolver.CallingType, location);
							IReturnType returnType = new DomReturnType (resolvedType);
							bool added = false;
							foreach (IUsing u in Document.CompilationUnit.Usings) {
								foreach (KeyValuePair<string, IReturnType> alias in u.Aliases) {
									if (alias.Value.ToInvariantString () == returnType.ToInvariantString ()) {
										cdc.Add (alias.Key, "md-class");
										added = true;
									}
								}
							}
							if (!added)
								cdc.Add (returnType);/*
							foreach (object o in CreateCtrlSpaceCompletionData (completionContext, result)) {
								MemberCompletionData memberData = o as MemberCompletionData;
								if (memberData == null || memberData.Member == null) {
									completionList.Add (o as CompletionData);
									continue;
								}
								if (memberData.Member is IMember) {
									returnType = ((IMember)memberData.Member).ReturnType;
								} else if (memberData.Member is IParameter) {
									returnType = ((IParameter)memberData.Member).ReturnType;
								} else {
									returnType = ((LocalVariable)memberData.Member).ReturnType;
								}
								// filter out void types
								if (returnType != null && returnType.FullName != DomReturnType.Void.FullName)
									completionList.Add (memberData);
							}*/
							completionList.AutoCompleteEmptyMatch = false;
							resolver.AddAccessibleCodeCompletionData (result.ExpressionContext, cdc);
							return completionList;
						}
						
						if (resolvedType.FullName == DomReturnType.Bool.FullName) {
							CompletionDataList completionList = new ProjectDomCompletionDataList ();
							CompletionDataCollector cdc = new CompletionDataCollector (dom, completionList, Document.CompilationUnit, resolver.CallingType, location);
开发者ID:famousthom,项目名称:monodevelop,代码行数:67,代码来源:CSharpTextEditorCompletion.cs

示例2: HandleCodeCompletion


//.........这里部分代码省略.........
                return null;
            case ' ':
                if (stateTracker.Engine.IsInsideDocLineComment || stateTracker.Engine.IsInsideOrdinaryCommentOrString)
                    return null;
                result = FindExpression (dom, completionContext);
                if (result == null)
                    return null;

                int tokenIndex = completionContext.TriggerOffset;
                string token = GetPreviousToken (ref tokenIndex, false);
                if (token == "=") {
                    int j = tokenIndex;
                    string prevToken = GetPreviousToken (ref j, false);
                    if (prevToken == "=" || prevToken == "+" || prevToken == "-") {
                        token = prevToken + token;
                        tokenIndex = j;
                    }
                }
                switch (token) {
                case "=":
                case "==":
                    result = FindExpression (dom, completionContext, tokenIndex - completionContext.TriggerOffset - 1);
                    resolver = new NRefactoryResolver (dom, Document.CompilationUnit, ICSharpCode.NRefactory.SupportedLanguage.CSharp, Editor, Document.FileName);
                    resolveResult = resolver.Resolve (result, location);
                    if (resolveResult != null) {
                        IType resolvedType = dom.GetType (resolveResult.ResolvedType);
                        if (resolvedType != null && resolvedType.ClassType == ClassType.Enum) {
                            CompletionDataList completionList = new ProjectDomCompletionDataList ();
                            CompletionDataCollector cdc = new CompletionDataCollector (completionList, Document.CompilationUnit, location);
                            IReturnType returnType = new DomReturnType (resolvedType);
                            bool added = false;
                            foreach (IUsing u in Document.CompilationUnit.Usings) {
                                foreach (KeyValuePair<string, IReturnType> alias in u.Aliases) {
                                    if (alias.Value.ToInvariantString () == returnType.ToInvariantString ()) {
                                        cdc.Add (alias.Key, "md-class");
                                        added = true;
                                    }
                                }
                            }
                            if (!added)
                                cdc.Add (returnType);
                            foreach (object o in CreateCtrlSpaceCompletionData (completionContext, result)) {
                                MemberCompletionData memberData = o as MemberCompletionData;
                                if (memberData == null || memberData.Member == null)
                                    continue;
                                if (memberData.Member is IMember) {
                                    returnType = ((IMember)memberData.Member).ReturnType;
                                } else if (memberData.Member is IParameter) {
                                    returnType = ((IParameter)memberData.Member).ReturnType;
                                } else {
                                    returnType = ((LocalVariable)memberData.Member).ReturnType;
                                }
                                if (returnType != null && returnType.FullName == resolvedType.FullName)
                                    completionList.Add (memberData);
                            }
                            completionList.AutoCompleteEmptyMatch = false;
                            return completionList;
                        }
                    }
                    return null;
                case "+=":
                case "-=":
                    if (stateTracker.Engine.IsInsideDocLineComment || stateTracker.Engine.IsInsideOrdinaryCommentOrString)
                        return null;
                    result = FindExpression (dom, completionContext, tokenIndex - completionContext.TriggerOffset);
                    resolver = new NRefactoryResolver (dom, Document.CompilationUnit, ICSharpCode.NRefactory.SupportedLanguage.CSharp, Editor, Document.FileName);
开发者ID:vasili,项目名称:FSharpBinding,代码行数:67,代码来源:FSharpTextEditorCompletion.cs


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