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


C# CodeExpression类代码示例

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


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

示例1: GenerateDefaultArgMethod

 protected override void GenerateDefaultArgMethod(
     CodeParameterDeclarationExpression[] argList,
     CodeExpression [] paramList)
 {
     var cons = gen.Constructor(argList, () => {});
     cons.ChainedConstructorArgs.AddRange(paramList);
 }
开发者ID:uxmal,项目名称:pytocs,代码行数:7,代码来源:ConstructorGenerator.cs

示例2: CodeMethodInvokeExpression

		public CodeMethodInvokeExpression(CodeExpression targetObject,
						   string methodName,
						   params CodeExpression[] parameters)
		{
			this.method = new CodeMethodReferenceExpression(targetObject, methodName);
			this.Parameters.AddRange(parameters);
		}
开发者ID:Orvid,项目名称:Orvid.Assembler,代码行数:7,代码来源:CodeMethodInvokeExpression.cs

示例3: CodeForStatement

 public CodeForStatement(CodeExpression init, CodeExpression condition,CodeExpression next, CodeStatement statement)
 {
   Init = init;
   Condition = condition;
   Next = next;
   Statement = statement;
 }
开发者ID:eightrivers,项目名称:SSharp,代码行数:7,代码来源:CodeForStatement.cs

示例4: CodeMethodReferenceExpression

		public CodeMethodReferenceExpression(CodeExpression targetObject, 
			string methodName, params CodeTypeReference[] typeParameters) :
			this (targetObject, methodName)
		{
			if (typeParameters != null && typeParameters.Length > 0)
				TypeArguments.AddRange(typeParameters);
		}
开发者ID:Orvid,项目名称:Orvid.Assembler,代码行数:7,代码来源:CodeMethodReferenceExpression.cs

示例5: WrapInCast

		public static CodeExpression WrapInCast(CodeExpression srcExpr, byte sizeInBits, bool forceCastOnLiteral = false)
		{
			CodeTypeReference tp = null;
			if (sizeInBits <= 8)
				tp = StaticTypeReferences.Byte;
			else if (sizeInBits <= 16)
				tp = StaticTypeReferences.UShort;
			else if (sizeInBits <= 32)
				tp = StaticTypeReferences.UInt;
			else if (sizeInBits <= 64)
				tp = StaticTypeReferences.ULong;
			else
				throw new Exception("Geeze, that's giant!");
			
			if (srcExpr is CodeCastExpression)
			{
				if (((CodeCastExpression)srcExpr).TargetType != tp)
					((CodeCastExpression)srcExpr).TargetType = tp;
				return srcExpr;
			}
			// This is only valid because of the 
			// context in which this method is called.
			// (aka. this call is used only to widen
			// values, it is never used to make them
			// smaller)
			else if (!forceCastOnLiteral && srcExpr is CodePrimitiveExpression)
			{
				return srcExpr;
			}
			
			return new CodeCastExpression(tp, srcExpr);
		}
开发者ID:Orvid,项目名称:Orvid.Assembler,代码行数:32,代码来源:Utils.cs

示例6: CodeIterationStatement

 public CodeIterationStatement(CodeStatement initStatement, CodeExpression testExpression, CodeStatement incrementStatement, params CodeStatement[] statements)
 {
     InitStatement = initStatement;
     TestExpression = testExpression;
     IncrementStatement = incrementStatement;
     Statements.AddRange(statements);
 }
开发者ID:Corillian,项目名称:corefx,代码行数:7,代码来源:CodeIterationStatement.cs

示例7: CodeVariableDeclarationStatement

		public CodeVariableDeclarationStatement(string type,
							 string name, 
							 CodeExpression initExpression)
		{
			this.type = new CodeTypeReference(type);
			this.name = name;
			this.initExpression = initExpression;
		}
开发者ID:Orvid,项目名称:Orvid.Assembler,代码行数:8,代码来源:CodeVariableDeclarationStatement.cs

示例8: CodeBinaryOperatorExpression

		public CodeBinaryOperatorExpression(CodeExpression left,
						     CodeBinaryOperatorType op,
						     CodeExpression right)
		{
			this.left = left;
			this.op = op;
			this.right = right;
		}
开发者ID:Orvid,项目名称:Orvid.Assembler,代码行数:8,代码来源:CodeBinaryOperatorExpression.cs

示例9: CodeConditionStatement

		public CodeConditionStatement(CodeExpression condition,
					       CodeStatement[] trueStatements,
					       CodeStatement[] falseStatements)
		{
			this.condition = condition;
			this.TrueStatements.AddRange(trueStatements);
			this.FalseStatements.AddRange(falseStatements);
		}
开发者ID:Orvid,项目名称:Orvid.Assembler,代码行数:8,代码来源:CodeConditionStatement.cs

示例10: CodeMethodReferenceExpression

 public CodeMethodReferenceExpression(CodeExpression targetObject, string methodName, params CodeTypeReference[] typeParameters)
 {
     TargetObject = targetObject;
     MethodName = methodName;
     if (typeParameters != null && typeParameters.Length > 0)
     {
         TypeArguments.AddRange(typeParameters);
     }
 }
开发者ID:Corillian,项目名称:corefx,代码行数:9,代码来源:codemethodreferenceexpression.cs

示例11: CodeView

 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Windows.Forms.Form"/> class.
 /// </summary>
 /// <remarks></remarks>
 public CodeView(CodeExpression<Proband> code)
 {
     InitializeComponent();
     Code = code;
     if (code != null)
     {
         string rtf = RenderToRtf(code);
         richTextBoxCode.Rtf = rtf;
     }
 }
开发者ID:sunsided,项目名称:maze-evolution,代码行数:14,代码来源:CodeView.cs

示例12: AddRange

		public void AddRange(CodeExpression[] value)
		{
			if (value == null)
			{
				throw new ArgumentNullException("value");
			}

			for (int i = 0; i < value.Length; i++)
			{
				Add(value[i]);
			}
		}
开发者ID:Orvid,项目名称:Orvid.Assembler,代码行数:12,代码来源:CodeExpressionCollection.cs

示例13: Ctor

		public void Ctor(string name, CodeExpression value)
		{
			if (string.IsNullOrEmpty(name))
			{
				var argument1 = new CodeAttributeArgument(value);
				Assert.Empty(argument1.Name);
				Assert.Equal(value, argument1.Value);
			}
			var argument2 = new CodeAttributeArgument(name, value);
			Assert.Equal(name ?? string.Empty, argument2.Name);
			Assert.Equal(value, argument2.Value);
		}
开发者ID:dotnet,项目名称:corefx,代码行数:12,代码来源:CodeAttributeArgumentTests.cs

示例14: RenderToRtf

 /// <summary>
 /// Rendert den Code als Rich Text
 /// </summary>
 /// <param name="code">Der Code</param>
 /// <returns></returns>
 private string RenderToRtf(CodeExpression<Proband> code)
 {
     StringBuilder builder = new StringBuilder();
     builder.AppendLine(@"{\rtf1\ansi\deff0");
     // crimson --> #DC143C
     // dodger --> #1E90FF
     builder.AppendLine(@"{\colortbl;\red255\green255\blue255;\red220\green20\blue60;\red30\green144\blue255;}");
     builder.AppendLine(@"{\fonttbl\f0\fswiss Consolas;}\f0\cf1");
     RenderToRtf(code, 0, builder);
     builder.AppendLine("}");
     return builder.ToString();
 }
开发者ID:sunsided,项目名称:maze-evolution,代码行数:17,代码来源:CodeView.cs

示例15: GetPaddedHexToString

		public override CodeExpression GetPaddedHexToString(CodeExpression obj, int padSize)
		{
			return new CodeBinaryOperatorExpression(
				new CodePrimitiveExpression("0x"),
				CodeBinaryOperatorType.StringConcat,
				new CodeMethodInvokeExpression(
					new CodeMethodReferenceExpression()
					{
						MethodName = "format"
					},
					new CodePrimitiveExpression("%0" + padSize.ToString() + "X"),
					obj
				)
			);
		}
开发者ID:Orvid,项目名称:Orvid.Assembler,代码行数:15,代码来源:DLangaugeProvider.cs


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