• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Ast.ObjectCreateExpression类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ICSharpCode.NRefactory.Ast.ObjectCreateExpression的典型用法代码示例。如果您正苦于以下问题:C# ObjectCreateExpression类的具体用法?C# ObjectCreateExpression怎么用?C# ObjectCreateExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ObjectCreateExpression类属于ICSharpCode.NRefactory.Ast命名空间,在下文中一共展示了ObjectCreateExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CheckPointObjectCreation

		void CheckPointObjectCreation(ObjectCreateExpression oce)
		{
			Assert.AreEqual(0, oce.Parameters.Count);
			Assert.AreEqual(2, oce.ObjectInitializer.CreateExpressions.Count);
			Assert.IsInstanceOf(typeof(PrimitiveExpression), CheckPropertyInitializationExpression(oce.ObjectInitializer.CreateExpressions[0], "X"));
			Assert.IsInstanceOf(typeof(PrimitiveExpression), CheckPropertyInitializationExpression(oce.ObjectInitializer.CreateExpressions[1], "Y"));
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:7,代码来源:ObjectCreateExpressionTests.cs


示例2: TrackedVisitBlockStatement

 public override object TrackedVisitBlockStatement(BlockStatement blockStatement, object data)
 {
     blockStatement.Children.Clear();
     TypeReference notImplmentedException = new TypeReference("System.NotImplementedException");
     ObjectCreateExpression objectCreate = new ObjectCreateExpression(notImplmentedException, new List<Expression>());
     blockStatement.Children.Add(new ThrowStatement(objectCreate));
     return null;
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:8,代码来源:StubTransformer.cs


示例3: VisitObjectCreateExpression

 public override object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
 {
     if(objectCreateExpression.CreateType.GenericTypes.Count>0)
     {
         UnlockWith(objectCreateExpression);
     }
     return base.VisitObjectCreateExpression(objectCreateExpression, data);
 }
开发者ID:timdams,项目名称:strokes,代码行数:8,代码来源:CreateGenericObject.cs


示例4: VisitObjectCreateExpression

            public override object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
            {
                var expr = objectCreateExpression.ObjectInitializer;

                if (expr.CreateExpressions.Count > 0 && !objectCreateExpression.IsAnonymousType)
                    UnlockWith(objectCreateExpression.ObjectInitializer); //Handing over the ObjectInitializer will make it highlight that code region only.

                return base.VisitObjectCreateExpression(objectCreateExpression, data);
            }
开发者ID:timdams,项目名称:strokes,代码行数:9,代码来源:InstantiateObjectWithInitAchievement.cs


示例5: CheckSimpleObjectCreateExpression

		void CheckSimpleObjectCreateExpression(ObjectCreateExpression oce)
		{
			Assert.AreEqual("MyObject", oce.CreateType.Type);
			Assert.AreEqual(3, oce.Parameters.Count);
			
			for (int i = 0; i < oce.Parameters.Count; ++i) {
				Assert.IsTrue(oce.Parameters[i] is PrimitiveExpression);
			}
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:9,代码来源:ObjectCreateExpressionTests.cs


示例6: ContainsInternalConstructor

 private bool ContainsInternalConstructor(IList constructors, ObjectCreateExpression objectCreateExpression)
 {
     foreach (ConstructorDeclaration constructor in constructors)
     {
         if (constructor.Parameters.Count == objectCreateExpression.Parameters.Count
             && (AstUtil.ContainsModifier(constructor, Modifiers.Internal) || AstUtil.ContainsModifier(constructor, Modifiers.Protected)))
             return true;
     }
     return false;
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:10,代码来源:InternalMethodInvocationTransformer.cs


示例7: CreateDebugListExpression

        /// <summary>
        /// Creates an expression which, when evaluated, creates a List&lt;T&gt; in the debugee
        /// filled with contents of IEnumerable&lt;T&gt; from the debugee.
        /// </summary>
        /// <param name="iEnumerableVariable">Expression for IEnumerable variable in the debugee.</param>
        /// <param name="itemType">
        /// The generic argument of IEnumerable&lt;T&gt; that <paramref name="iEnumerableVariable"/> implements.</param>
        public static Expression CreateDebugListExpression(Expression iEnumerableVariable, DebugType itemType, out DebugType listType)
        {
            // is using itemType.AppDomain ok?
            listType = DebugType.CreateFromType(itemType.AppDomain, typeof(System.Collections.Generic.List<>), itemType);
            var iEnumerableType = DebugType.CreateFromType(itemType.AppDomain, typeof(IEnumerable<>), itemType);
            // explicitely cast the variable to IEnumerable<T>, where T is itemType
            Expression iEnumerableVariableExplicitCast = new CastExpression { Expression = iEnumerableVariable.Clone() , Type = iEnumerableType.GetTypeReference() };

            var obj = new ObjectCreateExpression() { Type = listType.GetTypeReference() };
            obj.Arguments.Add(iEnumerableVariableExplicitCast);

            return obj;
        }
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:20,代码来源:DebuggerHelper.cs


示例8: TrackedVisitObjectCreateExpression

 public override object TrackedVisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
 {
     TypeDeclaration thisTypeDeclaration = (TypeDeclaration) AstUtil.GetParentOfType(objectCreateExpression, typeof(TypeDeclaration));
     if (IsTestFixture(thisTypeDeclaration))
     {
         string fullName = GetFullName(objectCreateExpression.CreateType);
         if (CodeBase.Types.Contains(fullName))
         {
             TypeDeclaration typeDeclaration = (TypeDeclaration) CodeBase.Types[fullName];
             IList constructors = AstUtil.GetChildrenWithType(typeDeclaration, typeof(ConstructorDeclaration));
             if (ContainsInternalConstructor(constructors, objectCreateExpression))
             {
                 Expression replacedExpression;
                 replacedExpression = CreateReflectionInstance(objectCreateExpression);
                 ReplaceCurrentNode(replacedExpression);
             }
         }
     }
     return base.TrackedVisitObjectCreateExpression(objectCreateExpression, data);
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:20,代码来源:InternalMethodInvocationTransformer.cs


示例9: VisitObjectCreateExpression

		public virtual object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data) {
			throw new global::System.NotImplementedException("ObjectCreateExpression");
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:3,代码来源:NotImplementedAstVisitor.cs


示例10: TrackedVisitObjectCreateExpression

            public override object TrackedVisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
            {
                if (data as bool? ?? false) {

                    #if DEBUG
                    LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver found object initialization: "+objectCreateExpression.ToString());
                    #endif

                    // Resolve the constructor.
                    // A type derived from the declaration type is also allowed.
                    MemberResolveResult mrr = this.Resolve(objectCreateExpression) as MemberResolveResult;

                    #if DEBUG
                    if (mrr != null) {
                        LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver: resolved constructor: "+mrr.ResolvedMember.ToString());
                    }
                    #endif

                    if (mrr != null &&
                        mrr.ResolvedMember is IMethod &&
                        (mrr.ResolvedMember.DeclaringType.CompareTo(this.resourceManagerMember.ReturnType.GetUnderlyingClass()) == 0 ||
                         mrr.ResolvedMember.DeclaringType.IsTypeInInheritanceTree(this.resourceManagerMember.ReturnType.GetUnderlyingClass()))
                       ) {

                        #if DEBUG
                        LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver: This is the correct constructor.");
                        #endif

                        // This most probably is the resource manager initialization we are looking for.
                        // Find a parameter that indicates the resources being referenced.

                        foreach (Expression param in objectCreateExpression.Parameters) {

                            PrimitiveExpression p = param as PrimitiveExpression;
                            if (p != null) {
                                string pValue = p.Value as string;
                                if (!String.IsNullOrEmpty(pValue)) {

                                    #if DEBUG
                                    LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver found string parameter: '"+pValue+"'");
                                    #endif

                                    this.foundResourceSet = NRefactoryResourceResolver.GetResourceSetReference(this.resourceManagerMember.DeclaringType.CompilationUnit.FileName, pValue);
                                    #if DEBUG
                                    if (this.foundResourceSet.FileName != null) {
                                        LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver found resource file: "+this.foundResourceSet.FileName);
                                    }
                                    #endif

                                    break;

                                }

                                continue;
                            }

                            // Support typeof(...)
                            TypeOfExpression t = param as TypeOfExpression;
                            if (t != null && this.PositionAvailable) {

                                #if DEBUG
                                LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver: Found TypeOfExpression in constructor call: "  + t.ToString());
                                #endif

                                ResolveResult rr = this.Resolve(new TypeReferenceExpression(t.TypeReference), ExpressionContext.Type);

                                #if DEBUG
                                if (rr == null) {
                                    LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver: The TypeReference of the TypeOfExpression could not be resolved.");
                                } else {
                                    LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver: The TypeReference resolved to: " + rr.ToString());
                                }
                                #endif

                                if (rr != null) {

                                    #if DEBUG
                                    LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver found typeof(...) parameter, type: '"+rr.ResolvedType.ToString()+"'");
                                    #endif

                                    this.foundResourceSet = NRefactoryResourceResolver.GetResourceSetReference(this.resourceManagerMember.DeclaringType.CompilationUnit.FileName, rr.ResolvedType.FullyQualifiedName);
                                    #if DEBUG
                                    if (this.foundResourceSet.FileName != null) {
                                        LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver found resource file: "+this.foundResourceSet.FileName);
                                    }
                                    #endif

                                    break;

                                }

                            }

                        }

                    }

                }

                return base.TrackedVisitObjectCreateExpression(objectCreateExpression, data);
//.........这里部分代码省略.........
开发者ID:ichengzi,项目名称:SharpDevelop,代码行数:101,代码来源:BclNRefactoryResourceResolver.cs


示例11: ObjectCreateExpression

	void ObjectCreateExpression(
#line  1935 "VBNET.ATG" 
out Expression oce) {

#line  1937 "VBNET.ATG" 
		TypeReference type = null;
		Expression initializer = null;
		List<Expression> arguments = null;
		ArrayList dimensions = null;
		oce = null;
		bool canBeNormal; bool canBeReDim;
		
		Expect(148);
		if (StartOf(7)) {
			NonArrayTypeName(
#line  1945 "VBNET.ATG" 
out type, false);
			if (la.kind == 25) {
				lexer.NextToken();
				NormalOrReDimArgumentList(
#line  1946 "VBNET.ATG" 
out arguments, out canBeNormal, out canBeReDim);
				Expect(26);
				if (la.kind == 23 || 
#line  1947 "VBNET.ATG" 
la.kind == Tokens.OpenParenthesis) {
					if (
#line  1947 "VBNET.ATG" 
la.kind == Tokens.OpenParenthesis) {
						ArrayTypeModifiers(
#line  1948 "VBNET.ATG" 
out dimensions);
						CollectionInitializer(
#line  1949 "VBNET.ATG" 
out initializer);
					} else {
						CollectionInitializer(
#line  1950 "VBNET.ATG" 
out initializer);
					}
				}

#line  1952 "VBNET.ATG" 
				if (canBeReDim && !canBeNormal && initializer == null) initializer = new CollectionInitializerExpression(); 
			}
		}

#line  1956 "VBNET.ATG" 
		if (initializer == null) {
		oce = new ObjectCreateExpression(type, arguments);
		} else {
			if (dimensions == null) dimensions = new ArrayList();
			dimensions.Insert(0, (arguments == null) ? 0 : Math.Max(arguments.Count - 1, 0));
			type.RankSpecifier = (int[])dimensions.ToArray(typeof(int));
			ArrayCreateExpression ace = new ArrayCreateExpression(type, initializer as CollectionInitializerExpression);
			ace.Arguments = arguments;
			oce = ace;
		}
		
		if (la.kind == 218) {

#line  1970 "VBNET.ATG" 
			NamedArgumentExpression memberInitializer = null;
			
			lexer.NextToken();

#line  1974 "VBNET.ATG" 
			CollectionInitializerExpression memberInitializers = new CollectionInitializerExpression();
			memberInitializers.StartLocation = la.Location;
			
			Expect(23);
			MemberInitializer(
#line  1978 "VBNET.ATG" 
out memberInitializer);

#line  1979 "VBNET.ATG" 
			memberInitializers.CreateExpressions.Add(memberInitializer); 
			while (la.kind == 12) {
				lexer.NextToken();
				MemberInitializer(
#line  1981 "VBNET.ATG" 
out memberInitializer);

#line  1982 "VBNET.ATG" 
				memberInitializers.CreateExpressions.Add(memberInitializer); 
			}
			Expect(24);

#line  1986 "VBNET.ATG" 
			memberInitializers.EndLocation = t.Location;
			if(oce is ObjectCreateExpression)
			{
				((ObjectCreateExpression)oce).ObjectInitializer = memberInitializers;
			}
			
		}
	}
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:97,代码来源:Parser.cs


示例12: TrackedVisitObjectCreateExpression

 public override object TrackedVisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
 {
     string fullName = GetFullName(objectCreateExpression.CreateType);
     if (CodeBase.References.Contains("Cons:" + fullName))
     {
         objectCreateExpression.Parameters.Add(new ThisReferenceExpression());
     }
     return base.TrackedVisitObjectCreateExpression(objectCreateExpression, data);
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:9,代码来源:ReferenceTransformer.cs


示例13: NewExpression

	void NewExpression(
#line  2065 "cs.ATG" 
out Expression pexpr) {

#line  2066 "cs.ATG" 
		pexpr = null;
		List<Expression> parameters = new List<Expression>();
		TypeReference type = null;
		Expression expr;
		
		Expect(89);
		if (StartOf(10)) {
			NonArrayType(
#line  2073 "cs.ATG" 
out type);
		}
		if (la.kind == 16 || la.kind == 20) {
			if (la.kind == 20) {

#line  2079 "cs.ATG" 
				ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters); 
				lexer.NextToken();

#line  2080 "cs.ATG" 
				if (type == null) Error("Cannot use an anonymous type with arguments for the constructor"); 
				if (StartOf(25)) {
					Argument(
#line  2081 "cs.ATG" 
out expr);

#line  2081 "cs.ATG" 
					SafeAdd(oce, parameters, expr); 
					while (la.kind == 14) {
						lexer.NextToken();
						Argument(
#line  2082 "cs.ATG" 
out expr);

#line  2082 "cs.ATG" 
						SafeAdd(oce, parameters, expr); 
					}
				}
				Expect(21);

#line  2084 "cs.ATG" 
				pexpr = oce; 
				if (la.kind == 16) {
					CollectionOrObjectInitializer(
#line  2085 "cs.ATG" 
out expr);

#line  2085 "cs.ATG" 
					oce.ObjectInitializer = (CollectionInitializerExpression)expr; 
				}
			} else {

#line  2086 "cs.ATG" 
				ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters); 
				CollectionOrObjectInitializer(
#line  2087 "cs.ATG" 
out expr);

#line  2087 "cs.ATG" 
				oce.ObjectInitializer = (CollectionInitializerExpression)expr; 

#line  2088 "cs.ATG" 
				pexpr = oce; 
			}
		} else if (la.kind == 18) {
			lexer.NextToken();

#line  2093 "cs.ATG" 
			ArrayCreateExpression ace = new ArrayCreateExpression(type);
			/* we must not change RankSpecifier on the null type reference*/
			if (ace.CreateType.IsNull) { ace.CreateType = new TypeReference(""); }
			pexpr = ace;
			int dims = 0; List<int> ranks = new List<int>();
			
			if (la.kind == 14 || la.kind == 19) {
				while (la.kind == 14) {
					lexer.NextToken();

#line  2100 "cs.ATG" 
					dims += 1; 
				}
				Expect(19);

#line  2101 "cs.ATG" 
				ranks.Add(dims); dims = 0; 
				while (la.kind == 18) {
					lexer.NextToken();
					while (la.kind == 14) {
						lexer.NextToken();

#line  2102 "cs.ATG" 
						++dims; 
					}
					Expect(19);

#line  2102 "cs.ATG" 
//.........这里部分代码省略.........
开发者ID:pluraldj,项目名称:SharpDevelop,代码行数:101,代码来源:Parser.cs


示例14: AppendGenericTypes

		/// <summary>
		/// Appends the types used when creating a generic surrounded by square brackets.
		/// </summary>
		void AppendGenericTypes(ObjectCreateExpression expression)
		{
			Append("[");
			List<TypeReference> typeRefs = expression.CreateType.GenericTypes;
			for (int i = 0; i < typeRefs.Count; ++i) {
				if (i != 0) {
					Append(", ");
				}
				TypeReference typeRef = typeRefs[i];
				if (typeRef.IsArrayType) {
					Append("Array[" + GetTypeName(typeRef) + "]");
				} else {
					Append(GetTypeName(typeRef));
				}
			}
			Append("]");
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:20,代码来源:NRefactoryToPythonConverter.cs


示例15: ObjectCreateExpression

	void ObjectCreateExpression(
#line  1860 "VBNET.ATG" 
out Expression oce) {

#line  1862 "VBNET.ATG" 
		TypeReference type = null;
		Expression initializer = null;
		List<Expression> arguments = null;
		ArrayList dimensions = null;
		oce = null;
		bool canBeNormal; bool canBeReDim;
		
		Expect(127);
		NonArrayTypeName(
#line  1869 "VBNET.ATG" 
out type, false);
		if (la.kind == 24) {
			lexer.NextToken();
			NormalOrReDimArgumentList(
#line  1870 "VBNET.ATG" 
out arguments, out canBeNormal, out canBeReDim);
			Expect(25);
			if (la.kind == 22 || 
#line  1871 "VBNET.ATG" 
la.kind == Tokens.OpenParenthesis) {
				if (
#line  1871 "VBNET.ATG" 
la.kind == Tokens.OpenParenthesis) {
					ArrayTypeModifiers(
#line  1872 "VBNET.ATG" 
out dimensions);
					CollectionInitializer(
#line  1873 "VBNET.ATG" 
out initializer);
				} else {
					CollectionInitializer(
#line  1874 "VBNET.ATG" 
out initializer);
				}
			}

#line  1876 "VBNET.ATG" 
			if (canBeReDim && !canBeNormal && initializer == null) initializer = new CollectionInitializerExpression(); 
		}

#line  1879 "VBNET.ATG" 
		if (type == null) type = new TypeReference("Object"); // fallback type on parser errors
		if (initializer == null) {
			oce = new ObjectCreateExpression(type, arguments);
		} else {
			if (dimensions == null) dimensions = new ArrayList();
			dimensions.Insert(0, (arguments == null) ? 0 : Math.Max(arguments.Count - 1, 0));
			type.RankSpecifier = (int[])dimensions.ToArray(typeof(int));
			ArrayCreateExpression ace = new ArrayCreateExpression(type, initializer as CollectionInitializerExpression);
			ace.Arguments = arguments;
			oce = ace;
		}
		
	}
开发者ID:almazik,项目名称:ILSpy,代码行数:59,代码来源:Parser.cs


示例16: VisitObjectCreateExpression

 public virtual object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
 {
     Debug.Assert((objectCreateExpression != null));
     Debug.Assert((objectCreateExpression.CreateType != null));
     Debug.Assert((objectCreateExpression.Parameters != null));
     Debug.Assert((objectCreateExpression.ObjectInitializer != null));
     objectCreateExpression.CreateType.AcceptVisitor(this, data);
     foreach (Expression o in objectCreateExpression.Parameters) {
         Debug.Assert(o != null);
         o.AcceptVisitor(this, data);
     }
     return objectCreateExpression.ObjectInitializer.AcceptVisitor(this, data);
 }
开发者ID:pusp,项目名称:o2platform,代码行数:13,代码来源:AbstractASTVisitor.cs


示例17: VisitObjectCreateExpression

		public override object VisitObjectCreateExpression (ObjectCreateExpression objectCreateExpression, object data)
		{
			if (objectCreateExpression.IsAnonymousType) {
				ResolveResult result =  new AnonymousTypeResolveResult (CreateAnonymousClass (objectCreateExpression.ObjectInitializer));
				result.CallingType   = resolver.CallingType;
				result.CallingMember = resolver.CallingMember;
				return result;
			}
			return CreateResult (objectCreateExpression.CreateType);
		}
开发者ID:Ein,项目名称:monodevelop,代码行数:10,代码来源:ResolveVisitor.cs


示例18: TrackedVisitObjectCreateExpression

 public override object TrackedVisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
 {
     this.Append(objectCreateExpression.CreateType.Type);
     if (NRefactoryToPythonConverter.IsGenericType(objectCreateExpression))
     {
         this.AppendGenericTypes(objectCreateExpression);
     }
     this.Append("(");
     bool flag = true;
     foreach (Expression parameter in objectCreateExpression.Parameters)
     {
         if (!flag)
         {
             this.Append(", ");
         }
         parameter.AcceptVisitor(this, data);
         flag = false;
     }
     bool flag1 = true;
     foreach (Expression createExpression in objectCreateExpression.ObjectInitializer.CreateExpressions)
     {
         if (!flag1)
         {
             this.Append(", ");
         }
         createExpression.AcceptVisitor(this, data);
         flag1 = false;
     }
     this.Append(")");
     return null;
 }
开发者ID:L3tum,项目名称:BesiegeScriptingMod,代码行数:31,代码来源:NRefactoryToPythonConverter.cs


示例19: AppendGenericTypes

 private void AppendGenericTypes(ObjectCreateExpression expression)
 {
     this.Append("[");
     List<TypeReference> genericTypes = expression.CreateType.GenericTypes;
     for (int i = 0; i < genericTypes.Count; i++)
     {
         if (i != 0)
         {
             this.Append(", ");
         }
         TypeReference item = genericTypes[i];
         if (!item.IsArrayType)
         {
             this.Append(this.GetTypeName(item));
         }
         else
         {
             this.Append(string.Concat("Array[", this.GetTypeName(item), "]"));
         }
     }
     this.Append("]");
 }
开发者ID:L3tum,项目名称:BesiegeScriptingMod,代码行数:22,代码来源:NRefactoryToPythonConverter.cs


示例20: VisitObjectCreateExpression

		public override object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
		{
			if (!objectCreateExpression.ObjectInitializer.IsNull)
				throw new EvaluateException(objectCreateExpression.ObjectInitializer, "Object initializers not supported");
			
			DebugType type = objectCreateExpression.CreateType.ResolveType(context.AppDomain);
			List<TypedValue> ctorArgs = EvaluateAll(objectCreateExpression.Parameters);
			ConstructorInfo ctor = type.GetConstructor(BindingFlags.Default, null, CallingConventions.Any, GetTypes(ctorArgs), null);
			if (ctor == null)
				throw new EvaluateException(objectCreateExpression, "Constructor not found");
			Value val = (Value)ctor.Invoke(GetValues(ctorArgs));
			return new TypedValue(val, type);
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:13,代码来源:ExpressionEvaluator.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Ast.ParameterDeclarationExpression类代码示例发布时间:2022-05-26
下一篇:
C# Ast.NamespaceDeclaration类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap