本文整理汇总了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);
示例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);