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


C# Constant类代码示例

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


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

示例1: Constant_accepts_Visitor

        public void Constant_accepts_Visitor()
        {
            var constant = new Constant(typeof(string), "a");
            constant.AcceptVisitor(theVisitor);

            theVisitor.AssertWasCalled(x => x.Constant(constant));
        }
开发者ID:joelweiss,项目名称:structuremap,代码行数:7,代码来源:Dependency_Visiting_Tester.cs

示例2: ApplyConstants

		public override Constant ApplyConstants(Constant c1, Constant c2)
		{
			return c1.ToInt32() != c2.ToInt32()
				? Constant.True() 
				: Constant.False();

		}
开发者ID:gitter-badger,项目名称:reko,代码行数:7,代码来源:ConditionalOperator.cs

示例3: ApplyConstant

 public override Constant ApplyConstant(Constant c)
 {
     if (c.IsValid)
         return c.Negate();
     else
         return c;
 }
开发者ID:relaxar,项目名称:reko,代码行数:7,代码来源:FNegOperator.cs

示例4: FormatValue

 public static string FormatValue(Constant c)
 {
     if (((PrimitiveType)c.DataType).Domain == Domain.SignedInt)
         return FormatSignedValue(c);
     else
         return FormatUnsignedValue(c);
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:7,代码来源:MachineOperand.cs

示例5: Constant_accepts_Visitor

        public void Constant_accepts_Visitor()
        {
            var constant = new Constant(typeof(string), "a");
            constant.AcceptVisitor(theVisitor);

            theVisitor.Received().Constant(constant);
        }
开发者ID:khellang,项目名称:structuremap,代码行数:7,代码来源:Dependency_Visiting_Tester.cs

示例6: defineConstant

 public Constant defineConstant(string name, Type type, object value)
 {
     if (null == name) name = ".C"+m_code.constants.Count;
     Constant c = new Constant(name, type, value);
     m_code.constants.Add(c);
     return c;
 }
开发者ID:JasonWilkins,项目名称:visitor-tk,代码行数:7,代码来源:FlatBuilder.cs

示例7: ConstantQuery

        //---------------------------------------------------------------------
        public static void ConstantQuery(OleDbConnection dbcon, CodeGenerator cg)
        {
            cg.ConstantList.Clear();
            OleDbCommand cmd = new OleDbCommand("SELECT * FROM Constants ORDER BY Topic, ID", dbcon);
            OleDbDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                Constant curConst = new Constant();
                curConst.Name = dr["Name"].ToString();
                curConst.Value = dr["Value"].ToString();
                Int32 nTopic = Convert.ToInt32(dr["Topic"].ToString());
                if (nTopic > 0)
                {
                    curConst.Topic = cg.TopicList[nTopic - 1].Name.ToString();
                }
                else
                {
                    curConst.Topic = "";
                }
                curConst.Description = dr["Description"].ToString();
                cg.ConstantList.Add(curConst);

                //curConst.Print();
            }

            dr.Close();
        }
开发者ID:kevinflueckiger,项目名称:Application-SDK,代码行数:29,代码来源:DBReader.cs

示例8: ApplyConstants

        public override Constant ApplyConstants(Constant c1, Constant c2)
        {
            if (!ValidArgs(c1, c2))
                return Constant.Invalid;

            return BuildConstant(c1.DataType, c2.DataType, (int) (c1.ToUInt64() - c2.ToUInt64()));
        }
开发者ID:relaxar,项目名称:reko,代码行数:7,代码来源:ISubOperator.cs

示例9: MatchMul

		public bool MatchMul(BinaryExpression b)
		{
			if (b.Operator == Operator.SMul || b.Operator == Operator.UMul || b.Operator == Operator.IMul)
			{
				Constant c = b.Left as Constant;
				Expression e = b.Right;
				if (c == null)
				{
					c = b.Right as Constant;
					e = b.Left;
				}
				if (c != null)
				{
					elemSize = c;
					Index = e;
					return true;
				}
			}
			if (b.Operator == Operator.Shl)
			{
				Constant c = b.Right as Constant;
				if (c != null)
				{
					elemSize = b.Operator.ApplyConstants(Constant.Create(b.Left.DataType, 1), c);
					Index = b.Left;
					return true;
				}
			}
			return false;
		}
开发者ID:killbug2004,项目名称:reko,代码行数:30,代码来源:ArrayExpressionMatcher.cs

示例10: ApplyConstants

		public override Constant ApplyConstants(Constant c1, Constant c2)
		{
            if (!ValidArgs(c1, c2))
                return Constant.Invalid;

            return Constant.Bool(c1.ToInt32() >= c2.ToInt32());
        }
开发者ID:relaxar,项目名称:reko,代码行数:7,代码来源:SignedIntOperators.cs

示例11: Initialize

    private void Initialize() {
      // create all symbols
      var sum = new Sum();
      var prog = new Prog();
      var frog = new Frog();
      var left = new Left();
      var forward = new Forward();
      var constant = new Constant();

      var allSymbols = new List<ISymbol>() { sum, prog, frog, left, forward, constant };

      // add all symbols to the grammar
      foreach (var s in allSymbols)
        AddSymbol(s);

      // define grammar rules
      foreach (var s in allSymbols) {
        AddAllowedChildSymbol(sum, s);
        AddAllowedChildSymbol(sum, s);
        AddAllowedChildSymbol(prog, s);
        AddAllowedChildSymbol(prog, s);
        AddAllowedChildSymbol(frog, s);
        AddAllowedChildSymbol(StartSymbol, s);
      }
    }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:25,代码来源:Grammar.cs

示例12: Match

		public bool Match(BinaryExpression exp)
		{
			if (exp.Operator != Operator.IAdd)
				return false;
			id = exp.Left as Identifier;
			
			bin = exp.Right as BinaryExpression;
			if ((id == null || bin == null) && exp.Operator  == Operator.IAdd)
			{
				id = exp.Right as Identifier;
				bin = exp.Left as BinaryExpression;
			}
			if (id == null || bin == null)
				return false;

			if (bin.Operator != Operator.SMul && bin.Operator != Operator.UMul && bin.Operator != Operator.IMul)
				return false;

			Identifier idInner = bin.Left as Identifier;
			cInner = bin.Right as Constant;
			if (idInner == null ||cInner == null)
				return false;

			if (idInner != id)
				return false;

			return true;
		}
开发者ID:killbug2004,项目名称:reko,代码行数:28,代码来源:Add_mul_id_c_id_Rule.cs

示例13: ConstantProjectedSlot

 /// <summary>
 /// Creates a slot with constant value being <paramref name="value"/>.
 /// </summary>
 internal ConstantProjectedSlot(Constant value, MemberPath memberPath)
 {
     Debug.Assert(value != null);
     Debug.Assert(value.IsNotNull() == false, "Cannot store NotNull in a slot - NotNull is only for conditions");
     m_constant = value;
     m_memberPath = memberPath;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:ConstantProjectedSlot.cs

示例14: Create

 internal static CilConstant Create(Constant constant, ref CilReaders readers)
 {
     CilConstant ilConstant = new CilConstant();
     ilConstant._constant = constant;
     ilConstant._readers = readers;
     ilConstant._isTypeInitialized = false;
     return ilConstant;
 }
开发者ID:TerabyteX,项目名称:corefxlab,代码行数:8,代码来源:CilConstant.cs

示例15: TextureReplacement

 public TextureReplacement(string fname, Constant fmt, int w, int h, float s)
 {
     filename = fname;
     format = (int)fmt;
     width = w;
     height = h;
     scale = s;
 }
开发者ID:RichardGale,项目名称:lwf,代码行数:8,代码来源:lwf_format.cs


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