本文整理汇总了C#中System.Collections.Generic.System.Collections.Generic.List.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Generic.List.AddRange方法的具体用法?C# System.Collections.Generic.List.AddRange怎么用?C# System.Collections.Generic.List.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Generic.System.Collections.Generic.List
的用法示例。
在下文中一共展示了System.Collections.Generic.List.AddRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BasicTest
public void BasicTest()
{
System.Collections.Generic.List<string> TestObject = new System.Collections.Generic.List<string>();
TestObject.AddRange(new string[] { "this", "is", "a", "test" });
ListMapping<int, string> Results = TestObject.Permute();
Assert.Equal(24, Results.Keys.Count);
foreach (int Key in Results.Keys)
foreach (string Item in Results[Key])
Assert.True(Item == "this" || Item == "is" || Item == "a" || Item == "test");
}
示例2: Fill
public void Fill(long house_id)
{
this.m_houseId = house_id;
System.Collections.Generic.List<FasetItem> list = new System.Collections.Generic.List<FasetItem> {
FasetItem.Null
};
list.AddRange(Mappers.FasetItemMapper.FindBySetNameFaset(this.GetSetNameFaset()));
this.bsFasetItems.set_DataSource(list);
this.selectedType.set_DataSource(list);
this.selectedType.set_DisplayMember("Name");
this.selectedType.set_ValueMember("Id");
this.dt = Mappers.HouseMapper.GetPropertyByHouse(house_id);
this.bsHousePropertys.set_DataSource(this.dt);
}
示例3: Fill
public void Fill()
{
System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string> { "" };
list.AddRange(Session.GetIpAddresses());
System.Collections.Generic.List<string> list2 = new System.Collections.Generic.List<string> { "" };
list2.AddRange(Session.GetUsernames());
System.Collections.Generic.List<string> list3 = new System.Collections.Generic.List<string> { "" };
list3.AddRange(Session.GetHostnames());
System.Collections.Generic.List<string> list4 = new System.Collections.Generic.List<string> { "" };
list4.AddRange(Session.GetArmNames());
this.cbIpAddress.set_DataSource(list);
this.cbUsername.set_DataSource(list2);
this.cbHostname.set_DataSource(list3);
this.cbArmName.set_DataSource(list4);
}
示例4: CrawlNow
public void CrawlNow(string p)
{
try
{
WebClient easyclient = new WebClient();
easyclient.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36");
easyclient.Headers.Add("accept-Encoding", "deflate");
string theHtml = easyclient.DownloadString(p);
WebHeaderCollection GetHeaders = easyclient.ResponseHeaders;
for (int i = 0; i < GetHeaders.Count; i++)
{
if (GetHeaders.GetKey(i).Contains("Last-Modified"))
{
internalDict.Add(p, GetHeaders.Get(i));
}
}
///creates an instance of the scraper;creates a generic list class;
///then adds to the list the links it finds on the url requested
/// then it adds url to queue
FindsLinksViaRegex linkfinder = new FindsLinksViaRegex();
List<LinkItem> linkitm = new System.Collections.Generic.List<LinkItem>();
linkitm.AddRange(linkfinder.Find(theHtml));
foreach (LinkItem info in linkitm)
{
if (info.Href != null)
{
qOfURls.Enqueue(info.Href);
}
}
}
catch( System.Net.WebException)
{
// do something
}
catch (Exception)
{
//catch other errors
}
}
示例5: AngleSort
// sortowanie katowe punktow z tablicy p w kierunku przeciwnym do ruchu wskazowek zegara wzgledem punktu centralnego c
// czyli sortowanie wzgledem roznacych katow odcinka (c,p[i]) z osia x
// przy pomocy parametru ifAngleEqual można doprwcyzować kryterium sortowania gdy katy sa rowne
// (domyslnie nic nie doprecyzowujemy, pozostawiamy rowne)
public static Point[] AngleSort(Point c, Point[] p, System.Comparison<Point> ifAngleEqual = null)
{
if (ifAngleEqual == null) ifAngleEqual = (p1, p2) => 0;
if (p == null) throw new System.ArgumentNullException();
if (p.Length < 2) return p;
System.Comparison<Point> cmp = delegate(Point p1, Point p2)
{
int r = -(new Geometry.Segment(c, p1)).Direction(p2);
return r != 0 ? r : ifAngleEqual(p1, p2);
};
var s1 = new System.Collections.Generic.List<Point>();
var s2 = new System.Collections.Generic.List<Point>();
for (int i = 0; i < p.Length; ++i)
if (p[i].y > c.y || (p[i].y == c.y && p[i].x >= c.x))
s1.Add(p[i]);
else
s2.Add(p[i]);
s1.Sort(cmp);
s2.Sort(cmp);
s1.AddRange(s2);
return s1.ToArray();
}
示例6: longTouFengWei
//判断龙头凤尾
private string[] longTouFengWei()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
int nums = 0;
List<string> mm = new List<string>();
foreach (Control ctls in this.ltfwMustGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
mm.Add(ctls.Text);
}
}
if (mm.Contains("包含"))
{
foreach (Control ctls in this.touDxGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(touDx());
}
}
foreach (Control ctls in this.touDsGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(touDs());
}
}
foreach (Control ctls in this.touZhGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(touZh());
}
}
foreach (Control ctls in this.weiDxGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(weiDx());
}
}
foreach (Control ctls in this.weiDsGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(weiDs());
}
}
foreach (Control ctls in this.weiZhGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(weiZh());
}
}
}
if (mm.Contains("杀去"))
{
foreach (Control ctls in this.touDxGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(touDx());
}
}
foreach (Control ctls in this.touDsGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(touDs());
}
}
foreach (Control ctls in this.touZhGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(touZh());
}
}
foreach (Control ctls in this.weiDxGpb.Controls)
{
if ((ctls as CheckBox).Checked == true)
{
nums++;
result.AddRange(weiDx());
//.........这里部分代码省略.........
示例7: quanTaiCal
//.........这里部分代码省略.........
for (int i = 0; i < allNum.Count(); i++)
{
string a = allNum[i].Substring(0, 1);
string b = allNum[i].Substring(1, 1);
string c = allNum[i].Substring(2, 1);
if (
(xiaoNums.Contains(a) && xiaoNums.Contains(b) && xiaoNums.Contains(c))
)
{
result.Add(allNum[i]);
}
}
}
else if (ctls.Name.Equals("he"))
{
for (int i = 0; i < allNum.Count(); i++)
{
string a = allNum[i].Substring(0, 1);
string b = allNum[i].Substring(1, 1);
string c = allNum[i].Substring(2, 1);
if (
(heNums.Contains(a) && heNums.Contains(b) && heNums.Contains(c))
)
{
result.Add(allNum[i]);
}
}
}
else if (ctls.Name.Equals("shuang"))
{
for (int i = 0; i < allNum.Count(); i++)
{
string a = allNum[i].Substring(0, 1);
string b = allNum[i].Substring(1, 1);
string c = allNum[i].Substring(2, 1);
if (
(shuangNums.Contains(a) && shuangNums.Contains(b) && shuangNums.Contains(c))
)
{
result.Add(allNum[i]);
}
}
}
else if (ctls.Name.Equals("da"))
{
for (int i = 0; i < allNum.Count(); i++)
{
string a = allNum[i].Substring(0, 1);
string b = allNum[i].Substring(1, 1);
string c = allNum[i].Substring(2, 1);
if (
(daNums.Contains(a) && daNums.Contains(b) && daNums.Contains(c))
)
{
result.Add(allNum[i]);
}
}
}
else if (ctls.Name.Equals("zuSan"))
{
for (int i = 0; i < allNum.Count(); i++)
{
int a = Convert.ToInt16(allNum[i].Substring(0, 1));
int b = Convert.ToInt16(allNum[i].Substring(1, 1));
int c = Convert.ToInt16(allNum[i].Substring(2, 1));
if (
a == b || a == c || b == c
)
{
result.Add(allNum[i]);
}
}
}
else if (ctls.Name.Equals("zuLiu"))
{
for (int i = 0; i < allNum.Count(); i++)
{
int a = Convert.ToInt16(allNum[i].Substring(0, 1));
int b = Convert.ToInt16(allNum[i].Substring(1, 1));
int c = Convert.ToInt16(allNum[i].Substring(2, 1));
if (
a != b && a != c && b != c
)
{
result.Add(allNum[i]);
}
}
}
}
}
if (cbkCount == 0)
{
result.AddRange(allNum);
}
List<string> result1 = result.Distinct().ToList();//去除重复项
result1.Sort();
return result1.ToArray();
}
示例8: kuaJu
//跨距
private string[] kuaJu()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
string[] allNum = heZhi();
if (killKuaDu.Checked == false)
{
List<int> nums = new List<int>();
foreach (Control ctls in this.kuaJuGpb.Controls)
{
bool isNum = isNumber(ctls.Text);
if ((ctls as CheckBox).Checked == true && isNum == true)
{
nums.Add(Convert.ToInt16(ctls.Text));
}
}
if (nums.Count > 0)
{
for (int i = 0; i < allNum.Count(); i++)
{
for (int j = 0; j < nums.Count(); j++)
{
int a = Convert.ToInt32(allNum[i].Substring(0, 1));
int b = Convert.ToInt32(allNum[i].Substring(1, 1));
int c = Convert.ToInt32(allNum[i].Substring(2, 1));
int max = 0;
int min = 0;
if (a > b)
{
if (a > c)
{
max = a;
}
else
{
max = c;
}
}
else
{
if (b > c)
{
max = b;
}
else
{
max = c;
}
}
if (a < b)
{
if (a < c)
{
min = a;
}
else
{
min = c;
}
}
else
{
if (b < c)
{
min = b;
}
else
{
min = c;
}
}
if (
max - min == nums[j]
)
{
result.Add(allNum[i]);
}
}
}
}
else
{
result.AddRange(allNum);
}
List<string> result1 = result.Distinct().ToList();//去除重复项
return result1.ToArray();
}
else
{
List<int> nums = new List<int>();
result.AddRange(allNum);
foreach (Control ctls in this.kuaJuGpb.Controls)
{
//.........这里部分代码省略.........
示例9: zhiLinSha
//临码之质临
private string[] zhiLinSha()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
string[] allNum = daXiaoSha();
string[] bigNum = { "1", "2", "3", "5", "7" };
if (zhiLinCbx.Checked == false)
{
result.AddRange(allNum);
}
if (zhiLinCbx.Checked && linMaShaQuCbx.Checked)//质临杀去
{
for (int i = 0; i < allNum.Count(); i++)
{
for (int j = 0; j < bigNum.Count(); j++)
{
if (
!(
((bigNum.Contains(allNum[i].Substring(0, 1)) && bigNum.Contains(allNum[i].Substring(1, 1))) && (Convert.ToInt32(allNum[i].Substring(0, 1)) - Convert.ToInt32(allNum[i].Substring(1, 1)) == 1))
||
((bigNum.Contains(allNum[i].Substring(0, 1)) && bigNum.Contains(allNum[i].Substring(1, 1))) && (Convert.ToInt32(allNum[i].Substring(1, 1)) - Convert.ToInt32(allNum[i].Substring(0, 1)) == 1))
||
((bigNum.Contains(allNum[i].Substring(1, 1)) && bigNum.Contains(allNum[i].Substring(2, 1))) && (Convert.ToInt32(allNum[i].Substring(1, 1)) - Convert.ToInt32(allNum[i].Substring(2, 1)) == 1))
||
((bigNum.Contains(allNum[i].Substring(1, 1)) && bigNum.Contains(allNum[i].Substring(2, 1))) && (Convert.ToInt32(allNum[i].Substring(2, 1)) - Convert.ToInt32(allNum[i].Substring(1, 1)) == 1))
||
((bigNum.Contains(allNum[i].Substring(0, 1)) && bigNum.Contains(allNum[i].Substring(2, 1))) && (Convert.ToInt32(allNum[i].Substring(0, 1)) - Convert.ToInt32(allNum[i].Substring(2, 1)) == 1))
||
((bigNum.Contains(allNum[i].Substring(0, 1)) && bigNum.Contains(allNum[i].Substring(2, 1))) && (Convert.ToInt32(allNum[i].Substring(2, 1)) - Convert.ToInt32(allNum[i].Substring(0, 1)) == 1))
)
)
{
result.Add(allNum[i]);
}
}
}
}
List<string> result1 = result.Distinct().ToList();//去除重复项
return result1.ToArray();
}
示例10: bianLinHeCal
//边临和
private string[] bianLinHeCal()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
string[] allNum = zuiDaLinMaJuLiCal();
int countChecked = 0;//计算勾选过数字没
foreach (Control ctls in this.bianLinHe.Controls)
{
if (ctls is CheckBox == false || (ctls as CheckBox).Checked == false)
{
continue;
}
countChecked++;
int _blh = Convert.ToInt32(ctls.Name.Split('_')[1]);//拿到勾选的边临和
for (int i = 0; i < allNum.Length; i++)
{
int a = Convert.ToInt16(allNum[i].Substring(0, 1));
int b = Convert.ToInt16(allNum[i].Substring(1, 1));
int c = Convert.ToInt16(allNum[i].Substring(2, 1));
//反边球运算 开始
int left = a;//得到百位之前空格数
int right = 9 - c;//得到个位之后空格数
int _fbq=left + right;
//反边球运算 结束
int leftCenter = 9 - a + b;//得到百位与十位在立体走势图中的空格数
int centerRight = 9 - b + c;//得到十位与个位在立体走势图中的空格数
if (leftCenter > centerRight && leftCenter + _fbq == _blh)//如果左边大于右边
{
result.Add(allNum[i]);
}
if (centerRight > leftCenter && centerRight + _fbq == _blh)//如果右边大于左边
{
result.Add(allNum[i]);
}
if (leftCenter == centerRight && centerRight + _fbq == _blh)//如果两个跨距相等
{
result.Add(allNum[i]);
}
}
}
if (countChecked == 0)
{
result.AddRange(allNum);
}
return result.ToArray();
}
示例11: fanBianQiuCal
//反边球
private string[] fanBianQiuCal()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
string[] allNum = bianLinHeCal();
int countChecked = 0;//计算勾选过数字没
foreach (Control ctls in this.fanBianQiu.Controls)
{
if (ctls is CheckBox == false || (ctls as CheckBox).Checked == false)
{
continue;
}
countChecked++;
int _fbq = Convert.ToInt16(ctls.Name.Split('_')[1]);//拿到勾选的反边球
for (int i = 0; i < allNum.Length; i++)
{
int a = Convert.ToInt16(allNum[i].Substring(0, 1));
int b = Convert.ToInt16(allNum[i].Substring(1, 1));
int c = Convert.ToInt16(allNum[i].Substring(2, 1));
int left = a;//得到百位之前空格数
int right = 9 - c;//得到个位之后空格数
if (left + right == _fbq)
{
result.Add(allNum[i]);
}
}
}
if (countChecked == 0)
{
result.AddRange(allNum);
}
return result.ToArray();
}
示例12: RequestProductInfoToPurchaseServer
public void RequestProductInfoToPurchaseServer( body2_SC_CHARGE_ITEMLIST[] _chargeItems)
{
dicChargeItemInfo.Clear();
List<string> listItemName = new System.Collections.Generic.List<string>();
dicChargeItemInfo = ConvertChargeItemListToDictionary( _chargeItems);
listItemName.AddRange( dicChargeItemInfo.Keys);
if( purchaseManager != null)
{
purchaseManager.RequestProductInfos( listItemName.ToArray());
}
else
{
#region -test-
#if UNITY_EDITOR
List<Store_Item_Info_Table> testList = new List<Store_Item_Info_Table>();
int count = 0;
foreach (body2_SC_CHARGE_ITEMLIST item in _chargeItems)
Debug.LogWarning(item.ToString());
foreach( string id in listItemName)
testList.Add( new Store_Item_Info_Table( Store_Item_Type.ChargeItem, count++, id, 1));
ProcessAfterReceiveProductInfo();
nowState = StoreState.NOTOUCH;
#endif
#endregion
}
}
示例13: zuiDaLinMaJuLiCal
//最大邻码跨距
private string[] zuiDaLinMaJuLiCal()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
string[] allNum = quanTaiCal();
int countChecked = 0;//计算勾选过数字没
foreach (Control ctls in this.zuiDaLinMaKuaJu.Controls)
{
if (ctls is CheckBox == false || (ctls as CheckBox).Checked == false)
{
continue;
}
countChecked++;
int _kuaJu = Convert.ToInt16(ctls.Name.Split('_')[1]);//拿到勾选的最大邻码跨距
for (int i = 0; i < allNum.Length; i++)
{
int a = Convert.ToInt16(allNum[i].Substring(0, 1));
int b = Convert.ToInt16(allNum[i].Substring(1, 1));
int c = Convert.ToInt16(allNum[i].Substring(2, 1));
int leftCenter = 9 - a + b;//得到百位与十位在立体走势图中的空格数
int centerRight = 9 - b + c;//得到十位与个位在立体走势图中的空格数
if (leftCenter > centerRight && leftCenter == _kuaJu)//如果左边大于右边
{
result.Add(allNum[i]);
}
if (centerRight > leftCenter && centerRight == _kuaJu)//如果右边大于左边
{
result.Add(allNum[i]);
}
if (leftCenter == centerRight && centerRight == _kuaJu)//如果两个跨距相等
{
result.Add(allNum[i]);
}
}
}
if (countChecked == 0)
{
result.AddRange(allNum);
}
return result.ToArray();
}
示例14: Main
static void Main(string[] args)
{
int hSeg = 16;
int vSeg = 8;
mikity.index myIndex = new mikity.index(); //節点番号と座標変数の対応表
mikity.index mask = new mikity.index(); //節点番号と座標変数の対応表
mikity.shape myShape = new mikity.shape(); //座標変数
mikity.elements Triangles = new mikity.elements(); //三角形要素
mikity.elements myElements = new mikity.elements(); //張力要素リスト
mikity.elements Border = new mikity.elements(); //境界要素リスト
//形状定義
System.Random rand = new System.Random(0);
for (int i = 0; i < hSeg; i++)
{
for (int j = 0; j < vSeg + 1; j++)
{
int num = i + j * (hSeg);
myIndex.Add(new int[3] { num * 3, num * 3 + 1, num * 3 + 2 });
myShape.AddRange(new double[3] { (rand.NextDouble() - 0.5) * 15d, (rand.NextDouble() - 0.5) * 15d, (rand.NextDouble() - 0.5) * 15d });
}
}
double Radius = 10.0;
for (int i = 0; i < hSeg; i++)
{
int num = i + 0 * (hSeg);
mask.Add(myIndex[num]);
double theta = System.Math.PI * 2 / hSeg * i;
myShape[mask.Last()] = new double[3] { Radius*System.Math.Cos(theta), Radius*System.Math.Sin(theta), -2.0 };
}
for (int i = 0; i < hSeg; i++)
{
int num = i + vSeg * (hSeg);
double theta = System.Math.PI * 2 / hSeg * i;
mask.Add(myIndex[num]);
myShape[mask.Last()] = new double[3] { Radius * System.Math.Cos(theta), Radius * System.Math.Sin(theta), 0.0 };
}
//基準正方形を構成する2つの三角形
int[,] _t = (matrix_INT)(new int[2, 2] { { 0, 1 }, { hSeg, hSeg+1 } });
Triangles.Add(new int[3] { _t[0, 0], _t[0, 1], _t[1, 0] });
Triangles.Add(new int[3] { _t[0, 1], _t[1, 1], _t[1, 0] });
int[] tmp = vector.lin(0, 1);
//作成した基準正方形を並べて行を作成
for (int i = 1; i < hSeg; i++)
{
Triangles.AddRange((elements)Triangles[tmp] + i);
}
Triangles[Triangles.Count-2][1] = 0;
Triangles[Triangles.Count-1][0] = 0;
Triangles[Triangles.Count-1][1] = hSeg;
//作成した基準行を並べて膜を作成
tmp = vector.lin(0, 2*hSeg-1);
for (int i = 1; i < vSeg; i++)
{
Triangles.AddRange((elements)Triangles[tmp] + i * (hSeg));
}
myElements.AddRange(Triangles);
//3項法の準備
mikity.term p = new mikity.term(myShape.Count); //加速度
mikity.term q = new mikity.term(myShape.Count); //速度
mikity.term x = new mikity.term(myShape); //位置
//GUIと可変パラメータの準備
mikity.visualize.FigureUI figUI = new mikity.visualize.FigureUI();
//時間の刻み幅
mikity.visualize.slider s1 = figUI.addSlider(min: 1, step: 2, max: 44, val: 38, text: "dt");
s1.Converter = val => Math.Pow(10, ((double)val / 10) - 4.8) * 2.0;
System.Collections.Generic.List<double> dt = new System.Collections.Generic.List<double>();
//リング間の距離
mikity.visualize.slider s2 = figUI.addSlider(min: 0, step: 2, max: 4000, val: 800, text: "Ring");
s2.Converter = val => (val)/200;
//描画ウインドウの準備
mikity.visualize.figure3D myFigure = new mikity.visualize.figure3D();
myFigure.xtitle = "Tanzbrunnen";
System.Collections.Generic.List<double> fps = new System.Collections.Generic.List<double>();
System.Collections.Generic.List<int> ticks = new System.Collections.Generic.List<int>();
ticks.AddRange(new int[101]);
//3項法のメインループ
int t = 0;
mikity.visualize.drawelements.scale(0.5);
while (figUI.Exit == false)
{
if (figUI.Pause == false)
{
t++;
ticks.Add(System.Environment.TickCount);
ticks.Remove(ticks[0]);
fps.Add((double)1000 / (ticks[100] - ticks[0]) * 100);
dt.Add(s1.value);
double w1 = s2.value;//リング
for (int i = 0; i < hSeg; i++)
{
double theta = System.Math.PI * 2 / hSeg * i;
myShape[mask[i]] = new double[3] { Radius * System.Math.Cos(theta), Radius * System.Math.Sin(theta), -w1 };
}
for (int i = 0; i < hSeg; i++)
{
double theta = System.Math.PI * 2 / hSeg * i;
//.........这里部分代码省略.........
示例15: AddItemToListForEditor
public void AddItemToListForEditor()
{
List<string> listItemName = new System.Collections.Generic.List<string>();
listItemName.AddRange( dicChargeItemInfo.Keys);
List<Store_Item_Info_Table> testList = new List<Store_Item_Info_Table>();
int count = 0;
foreach( string id in listItemName)
testList.Add( new Store_Item_Info_Table( Store_Item_Type.ChargeItem, count++, id, 1));
AddStoreItems( testList);
nowState = StoreState.NOTOUCH;
}