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

C# ObjectCreateExpression类代码示例

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

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



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

示例1: VisitObjectCreateExpression

            public override object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
            {
                var type = objectCreateExpression.Type as SimpleType;
                if (type != null && type.TypeArguments.Count > 0)
                    UnlockWith(objectCreateExpression);

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


示例2: VisitObjectCreateExpression

            public override object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
            {
                if(objectCreateExpression.Initializer.Elements.Count > 0)
                {
                    UnlockWith(objectCreateExpression.Initializer);
                }

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


示例3: ArgumentsInfo

        public ArgumentsInfo(IEmitter emitter, ObjectCreateExpression objectCreateExpression)
        {
            this.Emitter = emitter;
            this.Expression = objectCreateExpression;

            var arguments = objectCreateExpression.Arguments.ToList();
            this.ResolveResult = emitter.Resolver.ResolveNode(objectCreateExpression, emitter) as InvocationResolveResult;

            this.BuildArgumentsList(arguments);
            this.BuildTypedArguments(objectCreateExpression.Type);
        }
开发者ID:RashmiPankaj,项目名称:Bridge,代码行数:11,代码来源:ArgumentsInfo.cs


示例4: GetActions

			IEnumerable<CodeAction> GetActions(ObjectCreateExpression objectCreateExpression,
			                                   PrimitiveExpression firstParam, PrimitiveExpression secondParam)
			{
				yield return new CodeAction(context.TranslateString("Swap parameters"), script =>  {
					var newOCE = objectCreateExpression.Clone() as ObjectCreateExpression;
					newOCE.Arguments.Clear();
					newOCE.Arguments.Add(secondParam.Clone());
					newOCE.Arguments.Add(firstParam.Clone());
					script.Replace(objectCreateExpression, newOCE);
				});
			}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:11,代码来源:IncorrectExceptionParameterOrderingIssue.cs


示例5: VisitObjectCreateExpression

		public override object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
		{
			if (objectCreateExpression.Arguments.Count() == 2) {
				Expression obj = objectCreateExpression.Arguments.First();
				Expression func = objectCreateExpression.Arguments.Last();
				Annotation annotation = func.Annotation<Annotation>();
				if (annotation != null) {
					IdentifierExpression methodIdent = (IdentifierExpression)((InvocationExpression)func).Arguments.Single();
					MethodReference method = methodIdent.Annotation<MethodReference>();
					if (method != null) {
						if (HandleAnonymousMethod(objectCreateExpression, obj, method))
							return null;
						// Perform the transformation to "new Action(obj.func)".
						obj.Remove();
						methodIdent.Remove();
						if (!annotation.IsVirtual && obj is ThisReferenceExpression) {
							// maybe it's getting the pointer of a base method?
							if (method.DeclaringType != context.CurrentType) {
								obj = new BaseReferenceExpression();
							}
						}
						if (!annotation.IsVirtual && obj is NullReferenceExpression && !method.HasThis) {
							// We're loading a static method.
							// However it is possible to load extension methods with an instance, so we compare the number of arguments:
							bool isExtensionMethod = false;
							TypeReference delegateType = objectCreateExpression.Type.Annotation<TypeReference>();
							if (delegateType != null) {
								TypeDefinition delegateTypeDef = delegateType.Resolve();
								if (delegateTypeDef != null) {
									MethodDefinition invokeMethod = delegateTypeDef.Methods.FirstOrDefault(m => m.Name == "Invoke");
									if (invokeMethod != null) {
										isExtensionMethod = (invokeMethod.Parameters.Count + 1 == method.Parameters.Count);
									}
								}
							}
							if (!isExtensionMethod) {
								obj = new TypeReferenceExpression { Type = AstBuilder.ConvertType(method.DeclaringType) };
							}
						}
						// now transform the identifier into a member reference
						MemberReferenceExpression mre = new MemberReferenceExpression();
						mre.Target = obj;
						mre.MemberName = methodIdent.Identifier;
						methodIdent.TypeArguments.MoveTo(mre.TypeArguments);
						mre.AddAnnotation(method);
						objectCreateExpression.Arguments.Clear();
						objectCreateExpression.Arguments.Add(mre);
						return null;
					}
				}
			}
			return base.VisitObjectCreateExpression(objectCreateExpression, data);
		}
开发者ID:stgwilli,项目名称:ILSpy,代码行数:53,代码来源:DelegateConstruction.cs


示例6: VisitObjectCreateExpression

			public override void VisitObjectCreateExpression (ObjectCreateExpression objectCreateExpression)
			{
				base.VisitObjectCreateExpression (objectCreateExpression);
				if (objectCreateExpression.Initializer.IsNull || objectCreateExpression.Initializer.Elements.Count > 0)
					return;

				AddIssue (objectCreateExpression.Initializer, ctx.TranslateString ("Remove redundant empty initializer"),
					script => {
						var expr = (ObjectCreateExpression)objectCreateExpression.Clone ();
						expr.Initializer = ArrayInitializerExpression.Null;
						script.Replace (objectCreateExpression, expr);
					});
			}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:13,代码来源:RedundantObjectOrCollectionInitializerIssue.cs


示例7: AssignmentInCollectionInitializer

		public void AssignmentInCollectionInitializer()
		{
			Expression expr = new ObjectCreateExpression {
				Type = new SimpleType("List"),
				Initializer = new ArrayInitializerExpression(
					new ArrayInitializerExpression(
						new AssignmentExpression(new IdentifierExpression("a"), new PrimitiveExpression(1))
					)
				)
			};
			
			AssertOutput("new List {\n${\n$$a = 1\n$}\n}", expr);
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:13,代码来源:CSharpOutputVisitorTests.cs


示例8: VisitObjectCreateExpression

			public override void VisitObjectCreateExpression (ObjectCreateExpression objectCreateExpression)
			{
				base.VisitObjectCreateExpression (objectCreateExpression);

				if (objectCreateExpression.Initializer.IsNull ||
					objectCreateExpression.Arguments.Count > 0 ||
					objectCreateExpression.LParToken.IsNull)
					return;

				AddIssue (objectCreateExpression.LParToken.StartLocation, objectCreateExpression.RParToken.EndLocation,
					ctx.TranslateString ("Remove redundant empty argument list"), script => {
						var expr = new ObjectCreateExpression (objectCreateExpression.Type.Clone ()) {
							Initializer = (ArrayInitializerExpression)objectCreateExpression.Initializer.Clone ()
						};
						script.Replace (objectCreateExpression, expr);
					});
			}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:17,代码来源:RedundantObjectCreationArgumentListIssue.cs


示例9: VisitObjectCreateExpression

			public override void VisitObjectCreateExpression (ObjectCreateExpression objectCreateExpression)
			{
				base.VisitObjectCreateExpression (objectCreateExpression);

				if (objectCreateExpression.Initializer.IsNull ||
					objectCreateExpression.Arguments.Count > 0 ||
					objectCreateExpression.LParToken.IsNull)
					return;

				AddIssue (objectCreateExpression.LParToken.StartLocation, objectCreateExpression.RParToken.EndLocation,
					ctx.TranslateString ("Remove redundant empty argument list"), script => {
						var l1 = objectCreateExpression.LParToken.GetPrevNode ().EndLocation;
						var l2 = objectCreateExpression.RParToken.GetNextNode ().StartLocation;
						var o1 = script.GetCurrentOffset (l1);
						var o2 = script.GetCurrentOffset (l2);

						script.Replace (o1, o2 - o1, " ");
					});
			}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:19,代码来源:RedundantObjectCreationArgumentListIssue.cs


示例10: GetAllValidTypesFromObjectCreation

		static IEnumerable<IType> GetAllValidTypesFromObjectCreation(CSharpAstResolver resolver, ObjectCreateExpression invoke, AstNode parameter)
		{
			int index = GetArgumentIndex(invoke.Arguments, parameter);
			if (index < 0)
				yield break;

			var targetResult = resolver.Resolve(invoke.Type);
			if (targetResult is TypeResolveResult) {
				var type = ((TypeResolveResult)targetResult).Type;
				if (type.Kind == TypeKind.Delegate && index == 0) {
					yield return type;
					yield break;
				}
				foreach (var constructor in type.GetConstructors ()) {
					if (index < constructor.Parameters.Count)
						yield return constructor.Parameters [index].Type;
				}
			}
		}
开发者ID:RHE24,项目名称:SharpDevelop,代码行数:19,代码来源:TypeGuessing.cs


示例11: ArgumentsInfo

        public ArgumentsInfo(IEmitter emitter, ObjectCreateExpression objectCreateExpression)
        {
            this.Emitter = emitter;
            this.Expression = objectCreateExpression;

            var arguments = objectCreateExpression.Arguments.ToList();
            var rr = emitter.Resolver.ResolveNode(objectCreateExpression, emitter);
            var drr = rr as DynamicInvocationResolveResult;
            if (drr != null)
            {
                var group = drr.Target as MethodGroupResolveResult;

                if (group != null && group.Methods.Count() > 1)
                {
                    throw new EmitterException(objectCreateExpression, "Cannot compile this dynamic invocation because there are two or more method overloads with the same parameter count. To work around this limitation, assign the dynamic value to a non-dynamic variable before use or call a method with different parameter count");
                }
            }

            this.ResolveResult = rr as InvocationResolveResult;
            this.BuildArgumentsList(arguments);
            this.BuildTypedArguments(objectCreateExpression.Type);
        }
开发者ID:suyongquan88,项目名称:Bridge,代码行数:22,代码来源:ArgumentsInfo.cs


示例12: VisitObjectCreateExpression

			public override void VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression)
			{
				var type = context.Resolve(objectCreateExpression.Type) as TypeResolveResult;
				if (type == null)
					return;
				var parameters = objectCreateExpression.Arguments;
				if (parameters.Count != 2)
					return;
				var firstParam = parameters.FirstOrNullObject() as PrimitiveExpression;
				var secondParam = parameters.LastOrNullObject() as PrimitiveExpression;
				if (firstParam == null || firstParam.Value.GetType() != typeof(string) ||
					secondParam == null || firstParam.Value.GetType() != typeof(string))
					return;
				var leftLength = (firstParam.Value as string).Length;
				var rightLength = (secondParam.Value as string).Length;

				Func<int, int, bool> func;
				if (!rules.TryGetValue(type.Type.FullName, out func))
					return;
				if (!func(leftLength, rightLength))
					AddIssue(objectCreateExpression,
					         context.TranslateString("The parameters are in the wrong order"),
					         GetActions(objectCreateExpression, firstParam, secondParam));
			}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:24,代码来源:IncorrectExceptionParameterOrderingIssue.cs


示例13: HandleAnonymousMethod

		bool HandleAnonymousMethod(ObjectCreateExpression objectCreateExpression, Expression target, MethodReference methodRef)
		{
			// Anonymous methods are defined in the same assembly, so there's no need to Resolve().
			MethodDefinition method = methodRef as MethodDefinition;
			if (method == null || !method.Name.StartsWith("<", StringComparison.Ordinal))
				return false;
			if (!(method.IsCompilerGenerated() || IsPotentialClosure(method.DeclaringType)))
				return false;
			
			// Decompile the anonymous method:
			
			DecompilerContext subContext = context.Clone();
			subContext.CurrentMethod = method;
			BlockStatement body = AstMethodBodyBuilder.CreateMethodBody(method, subContext);
			TransformationPipeline.RunTransformationsUntil(body, v => v is DelegateConstruction, subContext);
			body.AcceptVisitor(this, null);
			
			AnonymousMethodExpression ame = new AnonymousMethodExpression();
			bool isLambda = false;
			if (method.Parameters.All(p => string.IsNullOrEmpty(p.Name))) {
				ame.HasParameterList = false;
			} else {
				ame.HasParameterList = true;
				ame.Parameters.AddRange(AstBuilder.MakeParameters(method.Parameters));
				if (ame.Parameters.All(p => p.ParameterModifier == ParameterModifier.None)) {
					isLambda = (body.Statements.Count == 1 && body.Statements.Single() is ReturnStatement);
				}
			}
			
			// Replace all occurrences of 'this' in the method body with the delegate's target:
			foreach (AstNode node in body.Descendants) {
				if (node is ThisReferenceExpression)
					node.ReplaceWith(target.Clone());
				
			}
			if (isLambda) {
				LambdaExpression lambda = new LambdaExpression();
				ame.Parameters.MoveTo(lambda.Parameters);
				Expression returnExpr = ((ReturnStatement)body.Statements.Single()).Expression;
				returnExpr.Remove();
				lambda.Body = returnExpr;
				objectCreateExpression.ReplaceWith(lambda);
			} else {
				ame.Body = body;
				objectCreateExpression.ReplaceWith(ame);
			}
			return true;
		}
开发者ID:stgwilli,项目名称:ILSpy,代码行数:48,代码来源:DelegateConstruction.cs


示例14: TransformByteCode


//.........这里部分代码省略.........
						if (dir != null) {
							return new UndocumentedExpression {
								UndocumentedExpressionType = UndocumentedExpressionType.MakeRef,
								Arguments = { dir.Expression.Detach() }
							};
						} else {
							return InlineAssembly(byteCode, args);
						}
					}
				case ILCode.Refanytype:
					return new UndocumentedExpression {
						UndocumentedExpressionType = UndocumentedExpressionType.RefType,
						Arguments = { arg1 }
					}.Member("TypeHandle");
				case ILCode.Refanyval:
					return MakeRef(
						new UndocumentedExpression {
							UndocumentedExpressionType = UndocumentedExpressionType.RefValue,
							Arguments = { arg1, new TypeReferenceExpression(operandAsTypeRef) }
						});
					case ILCode.Newobj: {
						Cecil.TypeReference declaringType = ((MethodReference)operand).DeclaringType;
						if (declaringType is ArrayType) {
							ComposedType ct = AstBuilder.ConvertType((ArrayType)declaringType) as ComposedType;
							if (ct != null && ct.ArraySpecifiers.Count >= 1) {
								var ace = new Ast.ArrayCreateExpression();
								ct.ArraySpecifiers.First().Remove();
								ct.ArraySpecifiers.MoveTo(ace.AdditionalArraySpecifiers);
								ace.Type = ct;
								ace.Arguments.AddRange(args);
								return ace;
							}
						}
						var oce = new Ast.ObjectCreateExpression();
						if (declaringType.IsAnonymousType()) {
							MethodDefinition ctor = ((MethodReference)operand).Resolve();
							if (methodDef != null) {
								oce.Initializer = new ArrayInitializerExpression();
								for (int i = 0; i < args.Count; i++) {
									oce.Initializer.Elements.Add(
										new NamedArgumentExpression {
											Identifier = ctor.Parameters[i].Name,
											Expression = args[i]
										});
								}
							}
							return oce;
						}
						oce.Type = AstBuilder.ConvertType(declaringType);
						oce.Arguments.AddRange(args);
						return oce.WithAnnotation(operand);
					}
					case ILCode.No: return InlineAssembly(byteCode, args);
					case ILCode.Nop: return null;
					case ILCode.Pop: return arg1;
					case ILCode.Readonly: return InlineAssembly(byteCode, args);
				case ILCode.Ret:
					if (methodDef.ReturnType.FullName != "System.Void") {
						return new Ast.ReturnStatement { Expression = arg1 };
					} else {
						return new Ast.ReturnStatement();
					}
					case ILCode.Rethrow: return new Ast.ThrowStatement();
					case ILCode.Sizeof:  return new Ast.SizeOfExpression { Type = operandAsTypeRef };
					case ILCode.Stloc: {
						ILVariable locVar = (ILVariable)operand;
开发者ID:KevinCathcart,项目名称:ILSpy,代码行数:67,代码来源:AstMethodBodyBuilder.cs


示例15: Visit

			public override object Visit (New newExpression)
			{
				var result = new ObjectCreateExpression ();
				var location = LocationsBag.GetLocations (newExpression);
				result.AddChild (new CSharpTokenNode (Convert (newExpression.Location), "new".Length), ObjectCreateExpression.Roles.Keyword);
				
				if (newExpression.TypeRequested != null)
					result.AddChild (ConvertToType (newExpression.TypeRequested), ObjectCreateExpression.Roles.Type);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), ObjectCreateExpression.Roles.LPar);
				AddArguments (result, location, newExpression.Arguments);
				
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), ObjectCreateExpression.Roles.RPar);
				
				return result;
			}
开发者ID:N3X15,项目名称:ILSpy,代码行数:17,代码来源:CSharpParser.cs


示例16: TransformByteCode


//.........这里部分代码省略.........
						});
					case ILCode.Newobj: {
						ITypeDefOrRef declaringType = ((IMethod)operand).DeclaringType;
						if (declaringType.TryGetSZArraySig() != null || declaringType.TryGetArraySig() != null) {
							ComposedType ct = AstBuilder.ConvertType(declaringType) as ComposedType;
							if (ct != null && ct.ArraySpecifiers.Count >= 1) {
								var ace = new Ast.ArrayCreateExpression();
								ct.ArraySpecifiers.First().Remove();
								ct.ArraySpecifiers.MoveTo(ace.AdditionalArraySpecifiers);
								ace.Type = ct;
								ace.Arguments.AddRange(args);
								return ace;
							}
						}
						if (declaringType.IsAnonymousType()) {
							MethodDef ctor = ((IMethod)operand).Resolve();
							if (methodDef != null) {
								AnonymousTypeCreateExpression atce = new AnonymousTypeCreateExpression();
								if (CanInferAnonymousTypePropertyNamesFromArguments(args, ctor.Parameters)) {
									atce.Initializers.AddRange(args);
								} else {
									int skip = ctor.Parameters.GetParametersSkip();
									for (int i = 0; i < args.Count; i++) {
										atce.Initializers.Add(
											new NamedExpression {
												NameToken = Identifier.Create(ctor.Parameters[i + skip].Name).WithAnnotation(ctor.Parameters[i + skip]),
												Expression = args[i]
											});
									}
								}
								return atce;
							}
						}
						var oce = new Ast.ObjectCreateExpression();
						oce.Type = AstBuilder.ConvertType(declaringType);
						oce.Arguments.AddRange(args);
						return oce.WithAnnotation(operand);
					}
					case ILCode.No: return InlineAssembly(byteCode, args);
					case ILCode.Nop: return null;
					case ILCode.Pop: return arg1;
					case ILCode.Readonly: return InlineAssembly(byteCode, args);
				case ILCode.Ret:
					if (methodDef.ReturnType.GetFullName() != "System.Void") {
						return new Ast.ReturnStatement { Expression = arg1 };
					} else {
						return new Ast.ReturnStatement();
					}
					case ILCode.Rethrow: return new Ast.ThrowStatement();
					case ILCode.Sizeof:  return new Ast.SizeOfExpression { Type = operandAsTypeRef };
					case ILCode.Stloc: {
						ILVariable locVar = (ILVariable)operand;
						if (!locVar.IsParameter)
							localVariablesToDefine.Add(locVar);
						return new Ast.AssignmentExpression(Ast.IdentifierExpression.Create(locVar.Name, locVar.IsParameter ? TextTokenType.Parameter : TextTokenType.Local).WithAnnotation(locVar), arg1);
					}
					case ILCode.Switch: return InlineAssembly(byteCode, args);
					case ILCode.Tailcall: return InlineAssembly(byteCode, args);
					case ILCode.Throw: return new Ast.ThrowStatement { Expression = arg1 };
					case ILCode.Unaligned: return InlineAssembly(byteCode, args);
					case ILCode.Volatile: return InlineAssembly(byteCode, args);
				case ILCode.YieldBreak:
					return new Ast.YieldBreakStatement();
				case ILCode.YieldReturn:
					return new Ast.YieldReturnStatement { Expression = arg1 };
				case ILCode.InitObject:
开发者ID:nakijun,项目名称:dnSpy,代码行数:67,代码来源:AstMethodBodyBuilder.cs


示例17: VisitCXXMethodDecl


//.........这里部分代码省略.........
				decl.Parameters.ElementAt(0).QualType.ToString() == "class Urho3D::Context *") {
				var ctor = new ConstructorDeclaration {
						Modifiers = Modifiers.Public,
						Body = new BlockStatement(),
						Initializer = new ConstructorInitializer { ConstructorInitializerType = ConstructorInitializerType.This }
					};
				ctor.Initializer.Arguments.Add(csParser.ParseExpression("Application.CurrentContext"));
				currentType.Members.Add(ctor);
			}

			if (method != null && methodReturn is Sharpie.Bind.Types.VoidType) {
				method.Body.Add(invoke);
				//	pn ($"fprintf (stderr,\"DEBUG {creturnType} {pinvoke_name} (...)\\n\");");
				cmethodBuilder.AppendLine($"{cinvoke.ToString()};");
			} else {
				ReturnStatement ret = null;
				Expression returnExpression;


				if (!isConstructor)
					ret = new ReturnStatement();

				switch (returnIsWrapped) {
				case WrapKind.HandleMember:
					returnExpression = new InvocationExpression (new MemberReferenceExpression (new IdentifierExpression ("Runtime"), "LookupRefCounted", methodReturn2), invoke);
					break;
				case WrapKind.UrhoObject:
					returnExpression = new InvocationExpression (new MemberReferenceExpression (new IdentifierExpression ("Runtime"), "LookupObject", methodReturn2), invoke);
					break;
				case WrapKind.EventHandler:
					returnExpression = invoke;
					break;
				case WrapKind.StringHash:
					returnExpression = new ObjectCreateExpression (new SimpleType ("StringHash"), invoke);
					break;
				case WrapKind.MarshalPtrToString:
					returnExpression = new InvocationExpression(new MemberReferenceExpression(new IdentifierExpression("Marshal"), "PtrToStringAnsi"), invoke);
					break;
				case WrapKind.MarshalPtrToStruct:
					returnExpression = new InvocationExpression(new MemberReferenceExpression(new IdentifierExpression("Marshal"), "PtrToStructure"), invoke, new TypeOfExpression(methodReturn2));
					returnExpression = new CastExpression(methodReturn2.Clone(), returnExpression);
					break;
				case WrapKind.VectorSharedPtr:
					var cacheName = "_" + method.Name + "_cache";
					var f = new FieldDeclaration () {
						ReturnType = method.ReturnType.Clone (),
						Modifiers = Modifiers.Private | (method.Modifiers & Modifiers.Static)
					};
					f.Variables.Add (new VariableInitializer (cacheName, null));
					currentType.Members.Add (f);
					
					var sharedPtrType = (methodReturn as SimpleType).TypeArguments.First ().Clone ();
					//TODO: check if UrhoObject
					var create = (sharedPtrType.ToString() == "AnimationState") ? "CreateVectorSharedPtrRefcountedProxy" : "CreateVectorSharedPtrProxy";

					returnExpression = new ConditionalExpression (
						new BinaryOperatorExpression (new IdentifierExpression (cacheName), BinaryOperatorType.InEquality, new PrimitiveExpression (null)),
						new IdentifierExpression (cacheName),
						new AssignmentExpression (
							new IdentifierExpression (cacheName), 
							new InvocationExpression (
								new MemberReferenceExpression (
									new IdentifierExpression ("Runtime"), create, sharedPtrType),
								invoke)));
						
						
开发者ID:corefan,项目名称:urho,代码行数:65,代码来源:CxxBinder.cs


示例18: Visit

			public override object Visit(NewInitialize newInitializeExpression)
			{
				var result = new ObjectCreateExpression();
				result.AddChild(new CSharpTokenNode(Convert(newInitializeExpression.Location), ObjectCreateExpression.NewKeywordRole), ObjectCreateExpression.NewKeywordRole);
				
				if (newInitializeExpression.TypeRequested != null)
					result.AddChild(ConvertToType(newInitializeExpression.TypeRequested), Roles.Type);
				
				var location = LocationsBag.GetLocations(newInitializeExpression);
				if (location != null)
					result.AddChild(new CSharpTokenNode(Convert(location [0]), Roles.LPar), Roles.LPar);
				AddArguments(result, newInitializeExpression.Arguments);
				if (location != null && location.Count > 1)
					result.AddChild(new CSharpTokenNode(Convert(location [1]), Roles.RPar), Roles.RPar);
				
				var init = ConvertCollectionOrObjectInitializers(newInitializeExpression.Initializers);
				if (init != null)
					result.AddChild(init, ObjectCreateExpression.InitializerRole);
				
				return result;
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:21,代码来源:CSharpParser.cs


示例19: ObjectCreateBlock

 public ObjectCreateBlock(IEmitter emitter, ObjectCreateExpression objectCreateExpression)
     : base(emitter, objectCreateExpression)
 {
     this.Emitter = emitter;
     this.ObjectCreateExpression = objectCreateExpression;
 }
开发者ID:wangxueqzz,项目名称:Bridge,代码行数:6,代码来源:ObjectCreateBlock.cs


示例20: Visit

			public override object Visit (NewInitialize newInitializeExpression)
			{
				var result = new ObjectCreateExpression ();
				result.AddChild (new CSharpTokenNode (Convert (newInitializeExpression.Location), "new".Length), ObjectCreateExpression.Roles.Keyword);
				
				if (newInitializeExpression.NewType != null)
					result.AddChild ((INode)newInitializeExpression.NewType.Accept (this), ObjectCreateExpression.Roles.ReturnType);
				
				var location = LocationsBag.GetLocations (newInitializeExpression);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), ObjectCreateExpression.Roles.LPar);
				AddArguments (result, location, newInitializeExpression.NewArguments);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), ObjectCreateExpression.Roles.RPar);
				
				return result;
			}
开发者ID:pgoron,项目名称:monodevelop,代码行数:17,代码来源:CSharpParser.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ObjectCreationExpressionSyntax类代码示例发布时间:2022-05-24
下一篇:
C# ObjectContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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