本文整理汇总了C#中ICSharpCode.NRefactory.Ast.ObjectCreateExpression.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectCreateExpression.ToString方法的具体用法?C# ObjectCreateExpression.ToString怎么用?C# ObjectCreateExpression.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.NRefactory.Ast.ObjectCreateExpression
的用法示例。
在下文中一共展示了ObjectCreateExpression.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TrackedVisitObjectCreateExpression
public override object TrackedVisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
{
if (data as bool? ?? false) {
#if DEBUG
LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver found object initialization: "+objectCreateExpression.ToString());
#endif
// Resolve the constructor.
// A type derived from the declaration type is also allowed.
MemberResolveResult mrr = this.Resolve(objectCreateExpression) as MemberResolveResult;
#if DEBUG
if (mrr != null) {
LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver: resolved constructor: "+mrr.ResolvedMember.ToString());
}
#endif
if (mrr != null &&
mrr.ResolvedMember is IMethod &&
(mrr.ResolvedMember.DeclaringType.CompareTo(this.resourceManagerMember.ReturnType.GetUnderlyingClass()) == 0 ||
mrr.ResolvedMember.DeclaringType.IsTypeInInheritanceTree(this.resourceManagerMember.ReturnType.GetUnderlyingClass()))
) {
#if DEBUG
LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver: This is the correct constructor.");
#endif
// This most probably is the resource manager initialization we are looking for.
// Find a parameter that indicates the resources being referenced.
foreach (Expression param in objectCreateExpression.Parameters) {
PrimitiveExpression p = param as PrimitiveExpression;
if (p != null) {
string pValue = p.Value as string;
if (!String.IsNullOrEmpty(pValue)) {
#if DEBUG
LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver found string parameter: '"+pValue+"'");
#endif
this.foundResourceSet = NRefactoryResourceResolver.GetResourceSetReference(this.resourceManagerMember.DeclaringType.CompilationUnit.FileName, pValue);
#if DEBUG
if (this.foundResourceSet.FileName != null) {
LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver found resource file: "+this.foundResourceSet.FileName);
}
#endif
break;
}
continue;
}
// Support typeof(...)
TypeOfExpression t = param as TypeOfExpression;
if (t != null && this.PositionAvailable) {
#if DEBUG
LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver: Found TypeOfExpression in constructor call: " + t.ToString());
#endif
ResolveResult rr = this.Resolve(new TypeReferenceExpression(t.TypeReference), ExpressionContext.Type);
#if DEBUG
if (rr == null) {
LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver: The TypeReference of the TypeOfExpression could not be resolved.");
} else {
LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver: The TypeReference resolved to: " + rr.ToString());
}
#endif
if (rr != null) {
#if DEBUG
LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver found typeof(...) parameter, type: '"+rr.ResolvedType.ToString()+"'");
#endif
this.foundResourceSet = NRefactoryResourceResolver.GetResourceSetReference(this.resourceManagerMember.DeclaringType.CompilationUnit.FileName, rr.ResolvedType.FullyQualifiedName);
#if DEBUG
if (this.foundResourceSet.FileName != null) {
LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver found resource file: "+this.foundResourceSet.FileName);
}
#endif
break;
}
}
}
}
}
return base.TrackedVisitObjectCreateExpression(objectCreateExpression, data);
//.........这里部分代码省略.........