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


C# Expression.GetHashCode方法代码示例

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


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

示例1: Filter

        public Filter(string filterText, Expression filter)
        {
            if (string.IsNullOrEmpty(filterText))
                throw new ArgumentNullException("filterText");

            Hash = (filter == null) ? 0 : filter.GetHashCode();
        }
开发者ID:goncalod,项目名称:csharp,代码行数:7,代码来源:ParameterizedCommandPlaceHolder.cs

示例2: ExpressionVertex

        public ExpressionVertex(Expression expression)
            : this()
        {
            FullName = expression.ToString();

            var fullTextFormatter = new FullTextFormatter();
            var shortTextFormatter = new ShortTextFormatter();

            FullName = fullTextFormatter.Format(expression);
            ShortName = shortTextFormatter.Format(expression);

            _expressionHashCode = expression.GetHashCode();
        }
开发者ID:vik-borisov,项目名称:VikExpressionTreeVisualizer,代码行数:13,代码来源:ExpressionVertex.cs

示例3: TryGetMemberValue

		private static bool TryGetMemberValue(Expression expression, out object value, Dictionary<int, bool> visited)
		{
			if (expression == null)
			{
				// used for static fields, etc
				value = null;
				return true;
			}
			// Mark this node as visited (processed)
			int expressionHash = expression.GetHashCode();
			if (!visited.ContainsKey(expressionHash))
			{
				visited.Add(expressionHash, true);
			}
			// Get Member Value, recurse if necessary
			switch (expression.NodeType)
			{
				case ExpressionType.Constant:
					value = ((ConstantExpression)expression).Value;
					return true;
				case ExpressionType.MemberAccess:
					var me = (MemberExpression)expression;
					object target;
					if (TryGetMemberValue(me.Expression, out target, visited))
					{
						// instance target
						switch (me.Member.MemberType)
						{
							case MemberTypes.Field:
								value = ((FieldInfo)me.Member).GetValue(target);
								return true;
							case MemberTypes.Property:
								value = ((PropertyInfo)me.Member).GetValue(target, null);
								return true;
						}
					}
					break;
			}
			// Could not retrieve value
			value = null;
			return false;
		}
开发者ID:ChrisNanda,项目名称:EntityFramework.Cache,代码行数:42,代码来源:QueryParameterVisitor.cs

示例4: SerializableExpression

 /// <summary>
 /// Constructor with an <see cref="Expression"/> and an <see cref="ExpressionConverter"/>.
 /// </summary>
 /// <param name="expression">The original, not serializable <see cref="Expression"/>.</param>
 /// <param name="expConverter">The <see cref="ExpressionConverter"/> to convert contained <see cref="Expression">Expressions</see>.</param>
 protected SerializableExpression(Expression expression, ExpressionConverter expConverter)
     : this(expression.NodeType, expression.Type, expConverter)
 {
     HashCode = expression.GetHashCode();
 }
开发者ID:Cohaesus,项目名称:Interlinq-2,代码行数:10,代码来源:SerializableExpression.cs

示例5: ContainsExpression

        internal bool ContainsExpression(Expression ex)
        {
            if (ex == null)
                return Filters.Any(x => x.Hash == 0);

            int h = ex.GetHashCode();
            return Filters.Any(x => x.Hash == h);
        }
开发者ID:goncalod,项目名称:csharp,代码行数:8,代码来源:ParameterizedCommandPlaceHolder.cs


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