本文整理汇总了C#中Expression.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.Equals方法的具体用法?C# Expression.Equals怎么用?C# Expression.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Expression
的用法示例。
在下文中一共展示了Expression.Equals方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GroupBy
public GroupBy (QueryBlock block, Expression elementSelector, QueryBlock elementBlock, Expression keySelector, Location loc)
: base (block, keySelector, loc)
{
//
// Optimizes clauses like `group A by A'
//
if (!elementSelector.Equals (keySelector)) {
this.element_selector = elementSelector;
this.element_block = elementBlock;
}
}
示例2: AreTheSame
private bool AreTheSame(Expression first, Expression second)
{
//those expressions' properties should point to the same objects, however the expressions themselves might not be the same object
if (first.CodeNodeType != second.CodeNodeType)
{
return false;
}
return first.Equals(second);
}
示例3: CompareTargets
protected bool CompareTargets(Expression assignee, Expression target)
{
if (target == null || assignee == null || target.CodeNodeType != assignee.CodeNodeType)
{
return false;
}
switch (target.CodeNodeType)
{
case CodeNodeType.PropertyReferenceExpression:
var propertyReference = target as PropertyReferenceExpression;
var assigneeProperty = assignee as PropertyReferenceExpression;
if (!propertyReference.Property.Equals(assigneeProperty.Property))
{
return false;
}
return CompareTargets(assigneeProperty.Target, propertyReference.Target);
default:
return target.Equals(assignee);
}
}
示例4: CheckEqualAssign
bool CheckEqualAssign (Expression t)
{
if (source is Assign) {
Assign a = (Assign) source;
if (t.Equals (a.Target))
return true;
return a is SimpleAssign && ((SimpleAssign) a).CheckEqualAssign (t);
}
return t.Equals (source);
}
示例5: AreEqual
/// <summary>
/// Decides if two expressions have the same semantics.
/// </summary>
/// <param name="first"> The first expression.</param>
/// <param name="second">The second expression.</param>
/// <returns>Returns true if the expressions have the same semantics.</returns>
private bool AreEqual(Expression first, Expression second)
{
return first.Equals(second);
}