當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。