本文整理汇总了C#中IExpression.GetText方法的典型用法代码示例。如果您正苦于以下问题:C# IExpression.GetText方法的具体用法?C# IExpression.GetText怎么用?C# IExpression.GetText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IExpression
的用法示例。
在下文中一共展示了IExpression.GetText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCondition
/// <summary>
/// Gets the condition.
/// </summary>
/// <param name="leftOperand">The left operand.</param>
/// <param name="operatorSign">The operator sign.</param>
/// <param name="rightOperand">The right operand.</param>
/// <returns></returns>
private ICSharpExpression GetCondition(IExpression leftOperand, string operatorSign, IExpression rightOperand)
{
switch (operatorSign)
{
case "<":
operatorSign = ">=";
break;
case ">":
operatorSign = "<=";
break;
case "<=":
operatorSign = ">";
break;
case ">=":
operatorSign = "<";
break;
}
return this.provider.ElementFactory.CreateExpression(string.Format("{0} {1} {2}", leftOperand.GetText(), operatorSign, rightOperand.GetText()));
}
示例2: Handle
public static ExpressionDescriptor Handle(IExpression expression, Dictionary<string, string> scopeParameters)
{
var invocationExpression = expression as IInvocationExpression;
if (invocationExpression != null)
{
return new InvocationExpression().Handle(invocationExpression, scopeParameters);
}
var referenceExpression = expression as IReferenceExpression;
if (referenceExpression != null)
{
return new ReferenceExpression().Handle(referenceExpression, scopeParameters);
}
var binaryExpression = expression as IBinaryExpression;
if (binaryExpression != null)
{
return new BinaryExpression().Handle(binaryExpression, scopeParameters);
}
var isExpression = expression as IIsExpression;
if (isExpression != null)
{
return new IsExpression().Handle(isExpression, scopeParameters);
}
var asExpression = expression as IAsExpression;
if (asExpression != null)
{
return new AsExpression().Handle(asExpression, scopeParameters);
}
var castExpression = expression as ICastExpression;
if (castExpression != null)
{
return new CastExpression().Handle(castExpression, scopeParameters);
}
var unaryOperatorExpression = expression as IUnaryOperatorExpression;
if (unaryOperatorExpression != null)
{
return new UnaryOperatorExpression().Handle(unaryOperatorExpression, scopeParameters);
}
var parenthesizedExpression = expression as IParenthesizedExpression;
if (parenthesizedExpression != null)
{
return new ParenthesizedExpression().Handle(parenthesizedExpression, scopeParameters);
}
var thisExpression = expression as IThisExpression;
if (thisExpression != null)
{
return new ThisExpression().Handle(thisExpression, scopeParameters);
}
var creationExpression = expression as IObjectCreationExpression;
if (creationExpression != null)
{
return new CreationExpression().Handle(creationExpression, scopeParameters);
}
var result = new ExpressionDescriptor
{
Template = expression.GetText()
};
return result;
}
开发者ID:JakobChristensen,项目名称:Resharper.PredictiveCodeSuggestions,代码行数:69,代码来源:ExpressionTemplateBuilder.cs