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


C# Construct类代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            Person myp = new Person();
            myp.Age = 38;

            Console.Write(myp.Age);

            //This constructs the object.
            //Looks like anon class in Java.
            Construct cDo = new Construct()
            {
                Name = "Jason",
                JobCode = 8675309
            };

            Console.WriteLine("Enter one - three");
            //Convert a String read from the user input to an INT.
            int result = int.Parse(Console.ReadLine());

            switch (result)
            {
                case 1:
                    Console.WriteLine("You entered:{0} ", result);
                    break;
                case 3:
                    Console.WriteLine("You entered:{0} ", result);
                    break;
                case 2:
                    Console.WriteLine("You entered:{0} ", result);
                    break;
                default:
                    break;
            }
        }
开发者ID:Hummingdroid,项目名称:Personal-CSharp-Projects-And-Practices,代码行数:34,代码来源:Program.cs

示例2: Billing

        public static void Billing(Construct construct)
        {
            var deligate = new BeginInvoiceRequestDelegate(BeginInvoiceRequest);
            var callback = new AsyncCallback(EndInvoiceRequest);

            deligate.BeginInvoke(construct, callback, null);
        }
开发者ID:ucdavis,项目名称:PTF,代码行数:7,代码来源:EmailBLL.cs

示例3: VisitConstruct

        /// <summary>Visits a constructor invocation.</summary>
        /// <param name="cons">Construction.</param>
        /// <returns>Resulting expression to visit.</returns>
        public override void VisitConstruct(Construct cons)
        {
            CheckMethod(
                ConstructAsInstanceInitializer(cons),
                x =>
                    x.DeclaringType.FullName.StartsWith("Microsoft.OData.Service.DataServiceException") &&
                    !HasParameterType(x, "System.Int32"),
                methodUnderCheck.FullName);

            base.VisitConstruct(cons);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:14,代码来源:WebDataServiceExceptionCtorRule.cs

示例4: ConstructComplete

        public static void ConstructComplete(Construct construct)
        {
            MailMessage message = new MailMessage();
            message.From = new MailAddress(fromEmail);                              // add in all the to emails
            if (adminEmails.Count() > 0) foreach (var a in adminEmails) { message.To.Add(a); }     // add in all from from emails
            message.Body = EmailText.STR_OrderCompleted + "<br/>Construct Code:" + construct.ConstructCode;
            message.Subject = "PTF Order Completed.";
            message.IsBodyHtml = true;

            SmtpClient client = new SmtpClient();
            client.Send(message);
        }
开发者ID:ucdavis,项目名称:PTF,代码行数:12,代码来源:EmailBLL.cs

示例5: CreateMonthly

    internal void CreateMonthly(Construct wts_, Technicals.ProductBase[] products_)
    {
      List<DateTime> dates = new List<DateTime>();
      List<double> vals = new List<double>();

      int countOfZerosThisMonth = 0;
      int numberOfRebalsThisMomth = 0;

      int currentMonth = 0;
      int currentYear = 0;

      for (int i = 0; i < wts_.Dates.Count; ++i)
      {
        if (wts_.Dates[i].Year != currentYear || wts_.Dates[i].Month != currentMonth)
        {
          if (currentMonth != 0)
          {
            dates.Add(new DateTime(currentYear, currentMonth, 1));
            vals.Add(Convert.ToDouble(countOfZerosThisMonth) / Convert.ToDouble(numberOfRebalsThisMomth));
          }

          countOfZerosThisMonth = 0;
          numberOfRebalsThisMomth = 0;
        }

        double[] weightsThisRebal = wts_.GetValues(wts_.Dates[i]);

        for(int y=0;y<weightsThisRebal.Length;++y)
          if (weightsThisRebal[y] == 0.0 && products_[y].IsValid(wts_.Dates[i]))
            ++countOfZerosThisMonth;

        ++numberOfRebalsThisMomth;

        currentMonth = wts_.Dates[i].Month;
        currentYear = wts_.Dates[i].Year;
      }

      dates.Add(new DateTime(currentYear, currentMonth, 1));
      vals.Add(Convert.ToDouble(countOfZerosThisMonth) / Convert.ToDouble(numberOfRebalsThisMomth));

      foreach (DateTime date in dates)
        dt.Columns.Add(date.ToString("MMM yy"), typeof(double));

      DataRow row = dt.NewRow();

      for (int i = 0; i < vals.Count; ++i)
        row[i] = vals[i];

      dt.Rows.Add(row);

      Chart.DataSource = dt;
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:52,代码来源:AverageZeroWeightsPerMonthChart.cs

示例6: VisitConstruct

        public override void VisitConstruct(Construct construct)
        {
            var memberBinding = construct.Constructor as MemberBinding;

            if (memberBinding != null
                && memberBinding.BoundMember.Name.Name == ".ctor"
                && memberBinding.BoundMember.DeclaringType.IsTask())
            {
                Problems.Add(new Problem(GetResolution(), construct.UniqueKey.ToString()));
            }

            base.VisitConstruct(construct);
        }
开发者ID:ZhaoYngTest01,项目名称:WebApi,代码行数:13,代码来源:DoNotConstructTaskInstancesRule.cs

示例7: VisitConstruct

 public override Expression VisitConstruct(Construct cons) {
   MemberBinding mb = cons.Constructor as MemberBinding;
   if (mb != null) {
     mb.TargetObject = this.VisitExpression(mb.TargetObject);
   }
   cons.Operands = this.VisitExpressionList(cons.Operands);
   this.composers.Clear();
   if (mb != null) {
     this.composers.Add(this.GetComposer(mb.TargetObject));
   }
   this.GetComposers(this.composers, cons.Operands);
   return (Expression) this.Compose(cons, this.composers);
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:13,代码来源:Partitioner.cs

示例8: Load

        public void Load()
        {
            string gamePicturePath = Path.Combine(_scenarioPath, "Picture");
            string gameDataPath = Path.Combine(_scenarioPath, "Data");

            // 地形タイプ情報の読み込み
            var landformInfos = LoadInfo();

            // 各チップ画像の取得
            var landImages = WarGlobal.BmpManager.GetSurfaces(
                Path.Combine(gamePicturePath, "BMAPCHAR.BMP"), WarGlobal.ChipSize);

            var objectImages = WarGlobal.BmpManager.GetSurfaces(
                Path.Combine(gamePicturePath, "BMAPOBJ.BMP"), WarGlobal.ChipSize,
                path => BitmapUtil.Load(path, Color.Black));

            // 地形チップの生成
            var landforms = new Landform[landImages.Count];
            // 地形タイプの読み込み
            using (var reader = new StreamReader(Path.Combine(gameDataPath, "TikeiType"), WarGlobal.Encoding))
            {
                var sc = new Scanner(reader);
                for (int i = 0; i < landforms.Length; i++)
                {
                    int id = sc.NextInt32(NumberStyles.HexNumber);
                    landforms[i] = new Landform(landImages[i], landformInfos[id + 1]);
                }
            }
            WarGlobal.Landforms = landforms;

            // オブジェクトチップの生成
            var constructs = new Construct[objectImages.Count + 2];
            // 0番目は移動不可, 1番目はnull
            for (int i = 2; i < objectImages.Count; i++)
            {
                int id;
                if (i > EndWall)
                    id = 18;
                else if (i > EndCity)
                    id = 17;
                else
                    id = 16;
                constructs[i] = new Construct(objectImages[i - 1], landformInfos[id + 1]);
            }
            // 移動不可オブジェクトの生成
            constructs[0] = new Construct(null, landformInfos[0]);

            WarGlobal.Constructs = constructs;
        }
开发者ID:ProjectTane,项目名称:FarenDotNet,代码行数:49,代码来源:LandformLoader.cs

示例9: CreateWeekly

    internal void CreateWeekly(Construct wts_, Technicals.ProductBase[] products_)
    {
      int lastDay = (int)DayOfWeek.Sunday;
      int countThisWeek = 0;
      List<DateTime> dates = new List<DateTime>();
      List<int> values = new List<int>();
      DateTime firsInWeek = wts_.Dates[0];

      for (int i = 0; i < wts_.Dates.Count; ++i)
      {
        DateTime rebalDate = wts_.Dates[i];

        int dayIndex = (int)rebalDate.DayOfWeek;

        if (dayIndex > lastDay)
        {
          ++countThisWeek;
          lastDay = dayIndex;
        }
        else
        {
          dates.Add(firsInWeek);
          values.Add(countThisWeek);
          countThisWeek = 1;
          firsInWeek = rebalDate;
          lastDay = dayIndex;
        }
      }

      // last one won't have been added to the list
      dates.Add(firsInWeek);
      values.Add(countThisWeek);

      foreach (DateTime date in dates)
        dt.Columns.Add(date.ToString("MMM yy"), typeof(double));

      DataRow row = dt.NewRow();

      for (int i = 0; i < values.Count; ++i)
        row[i] = values[i];

      dt.Rows.Add(row);

      Chart.DataSource = dt;
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:45,代码来源:AverageZeroWeightsPerMonthChart.cs

示例10: VisitConstruct

        /// <summary>Visits a constructor invocation.</summary>
        /// <param name="cons">Construction.</param>
        /// <returns>Resulting expression to visit.</returns>
        public override void VisitConstruct(Construct cons)
        {
            InstanceInitializer init = ConstructAsInstanceInitializer(cons);

            if (init != null)
            {
                CheckMethod(init,
                    x => x.DeclaringType.FullName == "System.CodeDom.CodeTypeReference" &&
                        !HasParameterType(x, "System.CodeDom.CodeTypeReferenceOptions"),
                    methodUnderCheck.FullName);

                CheckMethod(init,
                    x => x.DeclaringType.FullName == "System.CodeDom.CodeTypeReferenceExpression" &&
                        !HasParameterType(x, "System.CodeDom.CodeTypeReference"),
                        methodUnderCheck.FullName);

                CheckMethod(init,
                    x => x.DeclaringType.FullName == "System.CodeDom.CodeParameterDeclaration" &&
                        !HasParameterType(x, "System.CodeDom.CodeTypeReference"),
                        methodUnderCheck.FullName);

                CheckMethod(init,
                    x => x.DeclaringType.FullName == "System.CodeDom.CodeMemberField" &&
                        !HasParameterType(x, "System.CodeDom.CodeTypeReference"),
                        methodUnderCheck.FullName);

                CheckMethod(init,
                    x => x.DeclaringType.FullName == "System.CodeDom.CodeArrayCreateExpression" &&
                        !HasParameterType(x, "System.CodeDom.CodeTypeReference"),
                        methodUnderCheck.FullName);
                
                CheckMethod(init,
                    x => x.DeclaringType.FullName == "System.CodeDom.CodeCastExpression" &&
                        !HasParameterType(x, "System.CodeDom.CodeTypeReference"),
                        methodUnderCheck.FullName);

                CheckMethod(init,
                    x => x.DeclaringType.FullName == "System.CodeDom.CodeObjectCreateExpression" &&
                        !HasParameterType(x, "System.CodeDom.CodeTypeReference"),
                        methodUnderCheck.FullName);
            }

            base.VisitConstruct(cons);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:47,代码来源:CodeTypeReferenceRule.cs

示例11: VisitConstruct

        /// <summary>Visits a constructor invocation.</summary>
        /// <param name="cons">Construction.</param>
        /// <returns>Resulting expression to visit.</returns>
        public override void VisitConstruct(Construct cons)
        {
            CheckMethod(
                ConstructAsInstanceInitializer(cons),
                x =>
                    x.Template != null &&
                    x.Template.FullName == "System.Collections.Generic.HashSet`1.#ctor" &&
                    !HasParameterType(x, "System.Collections.Generic.IEqualityComparer`1"),
                methodUnderCheck.FullName);

            CheckMethod(
                ConstructAsInstanceInitializer(cons),
                x =>
                    x.Template != null &&
                    x.Template.FullName == "System.Collections.Generic.Dictionary`2.#ctor" &&
                    !HasParameterType(x, "System.Collections.Generic.IEqualityComparer`1"),
                methodUnderCheck.FullName);

            base.VisitConstruct(cons);
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:23,代码来源:HashSetCtorRule.cs

示例12: Main

    public static void Main(String[] Args)
    {
        Construct root = new Construct();

        root.setType( "rootConstruct" );

        root.setName( "rootName" );

        root.addAnnotation( "rootAnnotation1" );
        root.addAnnotation( "rootAnnotation2" );

        root.addSuper( "rootSuper1" );
        root.addSuper( "rootSuper2" );

        root.addModifier( new Modifier( "rootSwitchModifier" ) );
        root.addModifier( new Modifier( "rootStringModifier", "abc" ) );
        root.addModifier( new Modifier( "rootIntegerModifier", 123 ) );
        root.addModifier( new Modifier( "rootBooleanModifier", false ) );

        Construct child = new Construct();

        child.setType( "childConstruct" );

        child.setName( "childName" );

        child.addAnnotation( "childAnnotation1" );
        child.addAnnotation( "childAnnotation2" );

        child.addSuper( "childSuper1" );
        child.addSuper( "childSuper2" );

        child.addModifier( new Modifier( "childSwitchModifier" ) );
        child.addModifier( new Modifier( "childStringModifier", "abc" ) );
        child.addModifier( new Modifier( "childIntegerModifier", 123 ) );
        child.addModifier( new Modifier( "childBooleanModifier", false ) );

        root.addChild(child);

        Console.WriteLine( root );
    }
开发者ID:christophevg,项目名称:ADL,代码行数:40,代码来源:test.cs

示例13: BeginInvoiceRequest

        public static void BeginInvoiceRequest(Construct construct)
        {
            var reportName = "/PTF/Invoice";

            var parameters = new Dictionary<string, string>();
            parameters.Add("ConstructCode", construct.ConstructCode);

            var invoice = Get(reportName, parameters);
            var memoryStream = new MemoryStream(invoice);

            //var message = new MailMessage(fromEmail, billingEmail);
            var message = new MailMessage();
            message.From = new MailAddress(fromEmail);
            if (billingEmails.Count() > 0) foreach (var a in billingEmails) { message.To.Add(a); }
            if (adminEmails.Count() > 0) foreach( var a in adminEmails) {message.To.Add(a);}
            message.Attachments.Add(new Attachment(memoryStream, string.Format("{0}_{1}.pdf", construct.Order.ID, construct.ConstructCode)));
            message.Body = EmailText.STR_Billing;
            message.Subject = "PTF Order Ready for Billing";
            message.IsBodyHtml = true;

            SmtpClient client = new SmtpClient();
            client.Send(message);
        }
开发者ID:ucdavis,项目名称:PTF,代码行数:23,代码来源:EmailBLL.cs

示例14: VisitConstruct

 public override Expression VisitConstruct(Construct cons){
   cons = (Construct)base.VisitConstruct(cons);
   if (cons == null) return null;
   MemberBinding mb = cons.Constructor as MemberBinding;
   if (mb == null) return cons;
   Method meth = mb.BoundMember as Method;
   if (meth == null) return cons;
   ParameterList parameters = meth.Parameters;
   if (parameters == null) return cons;
   ExpressionList operands = cons.Operands;
   int n = operands == null ? 0 : operands.Count;
   if (n > parameters.Count) n = parameters.Count;
   for (int i = 0; i < n; i++){
     //^ assert operands != null;
     Expression e = operands[i];
     if (e == null) continue;
     Parameter p = parameters[i];
     if (p == null) continue;
     if (e.Type == null || p.Type == null) continue;
     if (e.Type.IsValueType && !p.Type.IsValueType)
       operands[i] = new BinaryExpression(e, new MemberBinding(null, e.Type), NodeType.Box, p.Type);
   }
   return cons;
 }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:24,代码来源:Specializer.cs

示例15: VisitConstruct

		public virtual Expression VisitConstruct (Construct node)
		{
			if (node == null)
				return null;

			node.Constructor = VisitExpression (node.Constructor);
			node.Arguments = VisitExpressionList (node.Arguments);

			return node;
		}
开发者ID:carrie901,项目名称:mono,代码行数:10,代码来源:DefaultNodeVisitor.cs


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