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


C# TList.Add方法代码示例

本文整理汇总了C#中TList.Add方法的典型用法代码示例。如果您正苦于以下问题:C# TList.Add方法的具体用法?C# TList.Add怎么用?C# TList.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TList的用法示例。


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

示例1: Main

        internal static void Main()
        {
            //// adding element + AutoGrow()
            TList<int> somelist = new TList<int>(2);
            somelist.Add(1);
            somelist.Add(2);
            somelist.Add(3);

            //// removing element by index
            somelist.RemoveAt(1);

            //// inserting element at given position
            somelist.InsertAt(0, 0);

            //// accessing element by index (I feel so sleepy that I dont't see 2)
            for (int i = 0; i < somelist.Count; i++)
            {
                Console.WriteLine(somelist[i]);
            }

            //// finding element by its value
            Console.WriteLine(somelist.Contains(3));

            ////ToString override
            Console.WriteLine(somelist.ToString());

            //// Min and max value
            int minValue = somelist.Min();
            int maxValue = somelist.Max();

            Console.WriteLine("MinValue = {0}\nMaxValue = {1}\n", minValue, maxValue);

            ////Clear list - List is empty & nothing is printed
            somelist.Clear();
            for (int i = 0; i < somelist.Count; i++)
            {
                Console.WriteLine(somelist[i]);
            }
        }
开发者ID:rusekov,项目名称:HomeWorksOOP,代码行数:39,代码来源:TestList_Main.cs

示例2: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed Region Entity with mock values.
        ///</summary>
        public static Region CreateMockInstance_Generated(TransactionManager tm)
        {
            Region mock = new Region();

            mock.RegionId = TestUtility.Instance.RandomNumber();
            mock.RegionDescription = TestUtility.Instance.RandomString(24, false);;

            // create a temporary collection and add the item to it
            TList<Region> tempMockCollection = new TList<Region>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Region)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:17,代码来源:RegionTest.generated.cs

示例3: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed Categories Entity with mock values.
        ///</summary>
        public static Categories CreateMockInstance_Generated(TransactionManager tm)
        {
            Categories mock = new Categories();

            mock.CategoryName = TestUtility.Instance.RandomString(6, false);;
            mock.Description = TestUtility.Instance.RandomString(2, false);;
            mock.Picture = new byte[] { TestUtility.Instance.RandomByte() };

            // create a temporary collection and add the item to it
            TList<Categories> tempMockCollection = new TList<Categories>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Categories)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:18,代码来源:CategoriesTest.generated.cs

示例4: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed CustomerCustomerDemo Entity with mock values.
        ///</summary>
        public static CustomerCustomerDemo CreateMockInstance_Generated(TransactionManager tm)
        {
            CustomerCustomerDemo mock = new CustomerCustomerDemo();

            //OneToOneRelationship
            CustomerDemographics mockCustomerDemographicsByCustomerTypeId = CustomerDemographicsTest.CreateMockInstance(tm);
            DataRepository.CustomerDemographicsProvider.Insert(tm, mockCustomerDemographicsByCustomerTypeId);
            mock.CustomerTypeId = mockCustomerDemographicsByCustomerTypeId.CustomerTypeId;
            //OneToOneRelationship
            Customers mockCustomersByCustomerId = CustomersTest.CreateMockInstance(tm);
            DataRepository.CustomersProvider.Insert(tm, mockCustomersByCustomerId);
            mock.CustomerId = mockCustomersByCustomerId.CustomerId;

            // create a temporary collection and add the item to it
            TList<CustomerCustomerDemo> tempMockCollection = new TList<CustomerCustomerDemo>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (CustomerCustomerDemo)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:23,代码来源:CustomerCustomerDemoTest.generated.cs

示例5: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed Suppliers Entity with mock values.
        ///</summary>
        public static Suppliers CreateMockInstance_Generated(TransactionManager tm)
        {
            Suppliers mock = new Suppliers();

            mock.CompanyName = TestUtility.Instance.RandomString(19, false);;
            mock.ContactName = TestUtility.Instance.RandomString(14, false);;
            mock.ContactTitle = TestUtility.Instance.RandomString(14, false);;
            mock.Address = TestUtility.Instance.RandomString(29, false);;
            mock.City = TestUtility.Instance.RandomString(6, false);;
            mock.Region = TestUtility.Instance.RandomString(6, false);;
            mock.PostalCode = TestUtility.Instance.RandomString(10, false);;
            mock.Country = TestUtility.Instance.RandomString(6, false);;
            mock.Phone = TestUtility.Instance.RandomString(11, false);;
            mock.Fax = TestUtility.Instance.RandomString(11, false);;
            mock.HomePage = TestUtility.Instance.RandomString(2, false);;

            // create a temporary collection and add the item to it
            TList<Suppliers> tempMockCollection = new TList<Suppliers>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Suppliers)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:26,代码来源:SuppliersTest.generated.cs

示例6: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed Territories Entity with mock values.
        ///</summary>
        public static Territories CreateMockInstance_Generated(TransactionManager tm)
        {
            Territories mock = new Territories();

            mock.TerritoryId = TestUtility.Instance.RandomString(9, false);;
            mock.TerritoryDescription = TestUtility.Instance.RandomString(24, false);;

            int count0 = 0;
            TList<Region> _collection0 = DataRepository.RegionProvider.GetPaged(tm, 0, 10, out count0);
            //_collection0.Shuffle();
            if (_collection0.Count > 0)
            {
                mock.RegionId = _collection0[0].RegionId;

            }

            // create a temporary collection and add the item to it
            TList<Territories> tempMockCollection = new TList<Territories>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Territories)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:26,代码来源:TerritoriesTest.generated.cs

示例7: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed Employees Entity with mock values.
        ///</summary>
        public static Employees CreateMockInstance_Generated(TransactionManager tm)
        {
            Employees mock = new Employees();

            mock.LastName = TestUtility.Instance.RandomString(9, false);;
            mock.FirstName = TestUtility.Instance.RandomString(10, false);;
            mock.Title = TestUtility.Instance.RandomString(14, false);;
            mock.TitleOfCourtesy = TestUtility.Instance.RandomString(11, false);;
            mock.BirthDate = TestUtility.Instance.RandomDateTime();
            mock.HireDate = TestUtility.Instance.RandomDateTime();
            mock.Address = TestUtility.Instance.RandomString(29, false);;
            mock.City = TestUtility.Instance.RandomString(6, false);;
            mock.Region = TestUtility.Instance.RandomString(6, false);;
            mock.PostalCode = TestUtility.Instance.RandomString(10, false);;
            mock.Country = TestUtility.Instance.RandomString(6, false);;
            mock.HomePhone = TestUtility.Instance.RandomString(11, false);;
            mock.Extension = TestUtility.Instance.RandomString(4, false);;
            mock.Photo = new byte[] { TestUtility.Instance.RandomByte() };
            mock.Notes = TestUtility.Instance.RandomString(2, false);;
            mock.PhotoPath = TestUtility.Instance.RandomString(126, false);;

            int count0 = 0;
            TList<Employees> _collection0 = DataRepository.EmployeesProvider.GetPaged(tm, 0, 10, out count0);
            //_collection0.Shuffle();
            if (_collection0.Count > 0)
            {
                mock.ReportsTo = _collection0[0].EmployeeId;

            }

            // create a temporary collection and add the item to it
            TList<Employees> tempMockCollection = new TList<Employees>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Employees)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:40,代码来源:EmployeesTest.generated.cs

示例8: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed OrderDetails Entity with mock values.
        ///</summary>
        public static OrderDetails CreateMockInstance_Generated(TransactionManager tm)
        {
            OrderDetails mock = new OrderDetails();

            mock.UnitPrice = TestUtility.Instance.RandomShort();
            mock.Quantity = TestUtility.Instance.RandomShort();
            mock.Discount = (float)TestUtility.Instance.RandomNumber();

            //OneToOneRelationship
            Orders mockOrdersByOrderId = OrdersTest.CreateMockInstance(tm);
            DataRepository.OrdersProvider.Insert(tm, mockOrdersByOrderId);
            mock.OrderId = mockOrdersByOrderId.OrderId;
            //OneToOneRelationship
            Products mockProductsByProductId = ProductsTest.CreateMockInstance(tm);
            DataRepository.ProductsProvider.Insert(tm, mockProductsByProductId);
            mock.ProductId = mockProductsByProductId.ProductId;

            // create a temporary collection and add the item to it
            TList<OrderDetails> tempMockCollection = new TList<OrderDetails>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (OrderDetails)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:27,代码来源:OrderDetailsTest.generated.cs

示例9: rptmnctg_ItemDataBound

 protected void rptmnctg_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         ProdCategory objproddtabound = e.Item.DataItem as ProdCategory;
         LinkButton lnkmainCTG = (LinkButton)e.Item.FindControl("lnkmainCTG");
         Repeater rptsubctg = (Repeater)e.Item.FindControl("rptsubctg");
         TList<ProdSubcategory> objprodsubctglist1 = new TList<ProdSubcategory>();
         List<int> objsubctgID = new List<int>();
         objsubctgID = ObjprodClass.GetAllProdmapBymainCtgID(objproddtabound.Id);
         if (objsubctgID != null)
         {
             foreach (int a in objsubctgID)
             {
                 objprodctg = null;
                 objprodctg = ObjprodClass.GetProdSubcategoryByID(a);
                 objprodsubctglist1.Add(objprodctg);
             }
         }
         rptsubctg.DataSource = objprodsubctglist1;
         rptsubctg.DataBind();
         lnkmainCTG.Text = objproddtabound.Name;
     }
 }
开发者ID:pratik1988,项目名称:VedicKart,代码行数:24,代码来源:Header.ascx.cs

示例10: CreateMockInstance_Generated

        ///<summary>
        ///  Returns a Typed Products Entity with mock values.
        ///</summary>
        public static Products CreateMockInstance_Generated(TransactionManager tm)
        {
            Products mock = new Products();

            mock.ProductName = TestUtility.Instance.RandomString(19, false);;
            mock.QuantityPerUnit = TestUtility.Instance.RandomString(9, false);;
            mock.UnitPrice = TestUtility.Instance.RandomShort();
            mock.UnitsInStock = TestUtility.Instance.RandomShort();
            mock.UnitsOnOrder = TestUtility.Instance.RandomShort();
            mock.ReorderLevel = TestUtility.Instance.RandomShort();
            mock.Discontinued = TestUtility.Instance.RandomBoolean();

            int count0 = 0;
            TList<Categories> _collection0 = DataRepository.CategoriesProvider.GetPaged(tm, 0, 10, out count0);
            //_collection0.Shuffle();
            if (_collection0.Count > 0)
            {
                mock.CategoryId = _collection0[0].CategoryId;

            }
            int count1 = 0;
            TList<Suppliers> _collection1 = DataRepository.SuppliersProvider.GetPaged(tm, 0, 10, out count1);
            //_collection1.Shuffle();
            if (_collection1.Count > 0)
            {
                mock.SupplierId = _collection1[0].SupplierId;

            }

            // create a temporary collection and add the item to it
            TList<Products> tempMockCollection = new TList<Products>();
            tempMockCollection.Add(mock);
            tempMockCollection.Remove(mock);

               return (Products)mock;
        }
开发者ID:jdaigle,项目名称:nettiers,代码行数:39,代码来源:ProductsTest.generated.cs

示例11: CreateMockInstance_Generated

		///<summary>
		///  Returns a Typed ProductProductPhoto Entity with mock values.
		///</summary>
		static public ProductProductPhoto CreateMockInstance_Generated(TransactionManager tm)
		{		
			ProductProductPhoto mock = new ProductProductPhoto();
						
			mock.Primary = TestUtility.Instance.RandomBoolean();
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
			//OneToOneRelationship
			Product mockProductByProductId = ProductTest.CreateMockInstance(tm);
			DataRepository.ProductProvider.Insert(tm, mockProductByProductId);
			mock.ProductId = mockProductByProductId.ProductId;
			//OneToOneRelationship
			ProductPhoto mockProductPhotoByProductPhotoId = ProductPhotoTest.CreateMockInstance(tm);
			DataRepository.ProductPhotoProvider.Insert(tm, mockProductPhotoByProductPhotoId);
			mock.ProductPhotoId = mockProductPhotoByProductPhotoId.ProductPhotoId;
		
			// create a temporary collection and add the item to it
			TList<ProductProductPhoto> tempMockCollection = new TList<ProductProductPhoto>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (ProductProductPhoto)mock;
		}
开发者ID:netTiers,项目名称:netTiers,代码行数:27,代码来源:ProductProductPhotoTest.generated.cs

示例12: FilterCombatUsers

        private static TList<CountryUser> FilterCombatUsers(CountryLvGroup lvGroup)
        {
            var list = new TList<CountryUser>();
            var removeList = new TList<CountryUser>();

            while (lvGroup.PairCombatQueue.Count > 0)
            {
                CountryUser cuser = lvGroup.PairCombatQueue.Get();
                if (cuser == null) continue;

                GameUser gameUser = new GameDataCacheSet<GameUser>().FindKey(cuser.UserId);
                if (gameUser != null && gameUser.UserStatus == UserStatus.CountryCombat)
                {
                    cuser.Status = 2;
                    list.Add(cuser);
                }
            }
            while (lvGroup.CombaQueue.Count > 0)
            {
                CountryUser cuser = lvGroup.CombaQueue.Get();
                if (cuser == null) continue;

                if (cuser.Status == 1 && cuser.Refresh.AddSeconds(CombatInterval) <= DateTime.Now)
                {
                    GameUser gameUser = new GameDataCacheSet<GameUser>().FindKey(cuser.UserId);
                    if (gameUser != null && gameUser.UserStatus == UserStatus.CountryCombat)
                    {
                        cuser.Status = 2;
                        list.Add(cuser);
                    }
                }
                else if (cuser.Status == 1)
                {
                    removeList.Add(cuser);
                }
            }
            foreach (var countryUser in removeList)
            {
                lvGroup.CombaQueue.Add(countryUser);
            }
            return list;
        }
开发者ID:rongxiong,项目名称:Scut,代码行数:42,代码来源:CountryCombat.cs

示例13: BuildListSection

    /// <summary>
    /// Build object to string result
    /// </summary>
    /// <param name="lstRosters"></param>
    /// <param name="date"></param>
    /// <returns></returns>
    private static object BuildListSection(TList<Roster> lstRosters, DateTime? date)
    {
        object lst = null;
        try
        {
            DataRepository.RosterProvider.DeepLoad(lstRosters);

            // Lay danh sach doctor theo appointment
            var lstDoctor = new TList<Users>();

            // Lay danh sach service theo appointment
            var lstService = new TList<Services>();

            foreach (var roster in lstRosters)
            {
                Roster roster1 = roster;
                if (!lstDoctor.Exists(doctor => doctor.Username == roster1.Username))
                {
                    lstDoctor.Add(roster.UsernameSource);
                }

                lstDoctor.Sort((p1, p2) => p1.DisplayName.CompareTo(p2.DisplayName));

                DataRepository.UsersProvider.DeepLoad(roster1.UsernameSource);

                if (!lstService.Exists(service => service.Id == roster1.UsernameSource.ServicesId))
                {
                    lstService.Add(DataRepository.ServicesProvider.GetById(Convert.ToInt32(roster1.UsernameSource.ServicesId)));
                }
            }

            // Sort theo priority
            lstService.Sort("PriorityIndex ASC");

            var dtStart = Convert.ToDateTime(date);
            var dtEnd = new DateTime(dtStart.Year, dtStart.Month, dtStart.Day, 23, 59, 59);
            dtStart = new DateTime(dtStart.Year, dtStart.Month, dtStart.Day);

            lst = lstService.Select(service => new
                {
                    service.Id,
                    Title = string.IsNullOrEmpty(service.ShortTitle) ? service.Title : service.ShortTitle,
                    Date = String.Format("{0:MM-dd-yyyy HH:mm:ss}", date),
                    Doctors = lstDoctor.Where(doctor => doctor.ServicesId == service.Id)
                        .Select(doctor => new
                        {
                            key = doctor.Username,
                            label = doctor.DisplayName,
                            Rosters = lstRosters.Where(roster => roster.Username == doctor.Username)
                                .Select(roster => new
                                    {
                                        startTime = (roster.StartTime < dtStart ? dtStart : roster.StartTime).ToString("MM-dd-yyyy HH:mm:ss"),
                                        endTime = (roster.EndTime > dtEnd ? dtEnd : roster.EndTime).ToString("MM-dd-yyyy HH:mm:ss"),
                                        color = roster.RosterTypeIdSource.ColorCode
                                    }).ToList()
                        }).ToList()
                }).ToList();
        }
        catch (Exception ex)
        {
            LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient());
        }
        return lst;
    }
开发者ID:williams55,项目名称:clinic-doctor,代码行数:70,代码来源:Default.aspx.cs

示例14: CreateMockInstance_Generated

		///<summary>
		///  Returns a Typed SalesTerritory Entity with mock values.
		///</summary>
		static public SalesTerritory CreateMockInstance_Generated(TransactionManager tm)
		{		
			SalesTerritory mock = new SalesTerritory();
						
			mock.Name = TestUtility.Instance.RandomString(24, false);;
			mock.CountryRegionCode = TestUtility.Instance.RandomString(3, false);;
			mock.Group = TestUtility.Instance.RandomString(24, false);;
			mock.SalesYtd = TestUtility.Instance.RandomShort();
			mock.SalesLastYear = TestUtility.Instance.RandomShort();
			mock.CostYtd = TestUtility.Instance.RandomShort();
			mock.CostLastYear = TestUtility.Instance.RandomShort();
			mock.ModifiedDate = TestUtility.Instance.RandomDateTime();
			
		
			// create a temporary collection and add the item to it
			TList<SalesTerritory> tempMockCollection = new TList<SalesTerritory>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (SalesTerritory)mock;
		}
开发者ID:netTiers,项目名称:netTiers,代码行数:25,代码来源:SalesTerritoryTest.generated.cs

示例15: CreateMockInstance_Generated

		///<summary>
		///  Returns a Typed NullFkeyParent Entity with mock values.
		///</summary>
		static public NullFkeyParent CreateMockInstance_Generated(TransactionManager tm)
		{		
			NullFkeyParent mock = new NullFkeyParent();
						
			mock.NullFkeyParentId = TestUtility.Instance.RandomNumber();
			mock.SomeText = TestUtility.Instance.RandomString(24, false);;
			
		
			// create a temporary collection and add the item to it
			TList<NullFkeyParent> tempMockCollection = new TList<NullFkeyParent>();
			tempMockCollection.Add(mock);
			tempMockCollection.Remove(mock);
			
		
		   return (NullFkeyParent)mock;
		}
开发者ID:WildGenie,项目名称:NetTiers,代码行数:19,代码来源:NullFkeyParentTest.generated.cs


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