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


C# IValue.GetType方法代码示例

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


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

示例1: Visit

        // Public Methods 

        public static IValue Visit(IValue src)
        {


            if (src.GetType() == typeof(StaticMemberAccessExpression))
            {
                var xx = src as StaticMemberAccessExpression;
                var fieldInfo = xx.Expression.DotnetType.GetField(xx.MemberName, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
                if (fieldInfo != null)
                {
                    throw new NotSupportedException();
                    // return Visit(new ClassFieldAccessExpression(fieldInfo));
                }
                var propertyInfo = xx.Expression.DotnetType.GetProperty(xx.MemberName, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
                if (propertyInfo != null)
                    return Visit(new CsharpInstancePropertyAccessExpression(propertyInfo, null));
                return src;
            }
            if (src.GetType() == typeof(InstanceMemberAccessExpression))
            {
                var xx = src as InstanceMemberAccessExpression;
                var t = xx.Expression.ValueType;
                var fieldInfo = t.GetField(xx.MemberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
                if (fieldInfo != null)
                    return Visit(new InstanceFieldAccessExpression(fieldInfo, xx.Expression));

                var propertyInfo = t.GetProperty(xx.MemberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
                if (propertyInfo != null)
                    return Visit(new CsharpInstancePropertyAccessExpression(propertyInfo, xx.Expression));
                return src;
            }

            if (src.GetType() == typeof(MemberAccessExpression))
            {
                var xx = src as MemberAccessExpression;
                if (xx.Expression is TypeValue)
                {
                    var yy = xx.Expression as TypeValue;
                    var tmp = new StaticMemberAccessExpression(xx.MemberName, new LangType(yy.DotnetType));
                    return Visit(tmp);

                }
                /*
                if (xx.Expression is LangType)
                {
                    var yy = xx.Expression as LangType;
                    var tmp = new StaticMemberAccessExpression(xx.MemberName, yy);
                    return Visit(tmp);
                } */
            }
            if (src is UnknownIdentifierValue)
            {

            }
            return src;
            throw new NotSupportedException();
        }
开发者ID:exaphaser,项目名称:cs2php,代码行数:59,代码来源:ExpressionConverterVisitor.cs

示例2: AddCustomValue

        private void AddCustomValue(XmlElement parent, PropertyAuditingData propertyAuditingData,
            IValue value, ISimpleMapperBuilder mapper, bool insertable, bool key)
        {
            if (parent != null) {
                XmlElement prop_mapping = MetadataTools.AddProperty(parent, propertyAuditingData.Name,
                        null, insertable, key);

                //CustomType propertyType = (CustomType) value.getType();

                XmlElement type_mapping = parent.OwnerDocument.CreateElement("type");
                prop_mapping.AppendChild(type_mapping);
                type_mapping.SetAttribute("name", value.GetType().Name);

                if (value is SimpleValue) {
                    IDictionary<string, string> typeParameters = ((SimpleValue)value).TypeParameters;
                    if (typeParameters != null) {
                        foreach (KeyValuePair<string,string> paramKeyValue in typeParameters) {
                            XmlElement type_param = parent.OwnerDocument.CreateElement("param");
                            type_param.SetAttribute("name", (String) paramKeyValue.Key);
                            type_param["name"].Value =  paramKeyValue.Value;
                        }
                    }
                }

                MetadataTools.AddColumns(prop_mapping, (IEnumerator<ISelectable>)value.ColumnIterator);
            }

            if (mapper != null) {
                mapper.Add(propertyAuditingData.getPropertyData());
            }
        }
开发者ID:hazzik,项目名称:nhcontrib-all,代码行数:31,代码来源:BasicMetadataGenerator.cs

示例3: Contains

 // left in right
 public virtual bool Contains(IValue right, IValue left)
 {
     throw new TypeInconsistancyException("Variable of type " + GetType() + " cannot contain a variable of type " +
                                          left.GetType());
 }
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:6,代码来源:Type.cs

示例4: EvalExpression


//.........这里部分代码省略.........
				return EvalNot(value);
			}
			if (expression is NPathParameter)
			{
				NPathParameter value = (NPathParameter)expression;
				return EvalParameter(value);
			}
			if (expression is NPathNullValue)
			{
				return EvalNullValue();
			}
			if (expression is NPathBooleanValue)
			{
				NPathBooleanValue value = (NPathBooleanValue)expression;
				return EvalBooleanValue(value);
			}
			if (expression is NPathDecimalValue)
			{
				NPathDecimalValue value = (NPathDecimalValue)expression;
				return EvalDecimalValue(value);
			}
			if (expression is NPathDateTimeValue)
			{
				NPathDateTimeValue value = (NPathDateTimeValue)expression;
				return EvalDateTimeValue(value);
			}
			if (expression is NPathGuidValue)
			{
				NPathGuidValue value = (NPathGuidValue)expression;
				return EvalGuidValue(value);
			}
			if (expression is NPathStringValue)
			{
				NPathStringValue value = (NPathStringValue)expression;
				return EvalStringValue(value);
			}
			if (expression is NPathIdentifier)
			{
				NPathIdentifier propertyPath = (NPathIdentifier) expression;
				return EvalIdentifier(propertyPath);
			}
			//			if (expression is PropertyFilter)
			//			{
			//				PropertyFilter propertyFilter = (PropertyFilter) expression;
			//				return EvalPropertyFilter(propertyFilter);
			//			}
			if (expression is NPathParenthesisGroup) // SearchCondition
			{
				NPathParenthesisGroup parenthesisGroup = (NPathParenthesisGroup) expression;
				return EvalParenthesisGroup(parenthesisGroup);
			}
			//			if (expression is MathExpression)
			//			{
			//				MathExpression mathExpression = (MathExpression) expression;
			//				return EvalMathExpression(mathExpression);
			//			}
			if (expression is NPathBooleanExpression)  // SearchCondition
			{
				NPathBooleanExpression boolExpression = (NPathBooleanExpression) expression;
				return EvalBooleanExpression(boolExpression);
			}

			if (expression is NPathFunction) // Function
			{
				NPathFunction value = (NPathFunction)expression;
				return EvalFunction(value);
			}
			if (expression is NPathCompareExpression) // ComparePredicate
			{
				NPathCompareExpression compareExpression = (NPathCompareExpression) expression;
				return EvalCompareExpression(compareExpression);
			}
			if (expression is NPathBetweenExpression) // BetweenPredicate
			{
				NPathBetweenExpression value = (NPathBetweenExpression)expression;
				return EvalBetween(value);
			}
			if (expression is NPathInExpression) // InPredicate
			{
				NPathInExpression value = (NPathInExpression)expression;
				return EvalIn(value);
			}
			if (expression is NPathMathExpression) // InPredicate
			{
				NPathMathExpression value = (NPathMathExpression)expression;
				return EvalMath(value);
			}
			if (expression is NPathSelectQuery)
			{
				NPathSelectQuery query = (NPathSelectQuery)expression;
				return EvalSubQuery(query);
			}

			//			if (expression is SearchFunction) //FreeTextPredicate
			//			{
			//				SearchFunction value = (SearchFunction)expression;
			//				return EvalSearchFunction(value);
			//			}
			throw new IAmOpenSourcePleaseImplementMeException(string.Format("Expressions of type '{0}' is not yet implemented",expression.GetType().Name) ) ;
		}
开发者ID:Dawn-of-Light,项目名称:Puzzle.NET,代码行数:101,代码来源:SqlEmitter.cs

示例5: Initialize

 /// <summary>
 /// Initializes the specified key.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="initialValue">The initial value.</param>
 /// <param name="direction">The direction (Input / Output).</param>
 /// <param name="comment">The comment.</param>
 /// <returns>This.</returns>
 public IParameter Initialize(string key, IValue initialValue, EnumParameterDirection direction = EnumParameterDirection.Input, string comment = "")
 {
     this.Key = key;
     this.Comment = comment;
     this.ParameterDirection = direction;
     this.ParameterType = initialValue.GetType() == typeof (DigitalValue) ? EnumParameterType.Digital : EnumParameterType.Analog;
     this.IsUptoDate = false;
     this.value = initialValue;
     return this;
 }
开发者ID:Mib314,项目名称:Sol2Reg,代码行数:18,代码来源:Parameter.cs


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