本文整理汇总了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]);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}