本文整理汇总了C#中System.Collections.Generic.System.Collections.Generic.List.Distinct方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Generic.List.Distinct方法的具体用法?C# System.Collections.Generic.List.Distinct怎么用?C# System.Collections.Generic.List.Distinct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Generic.System.Collections.Generic.List
的用法示例。
在下文中一共展示了System.Collections.Generic.List.Distinct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ao
//凹凸之凹
private string[] ao()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
string[] allNum = linMa();
for (int i = 0; i < allNum.Count(); i++)
{
if (
Convert.ToInt32(allNum[i].Substring(0, 1)) > Convert.ToInt32(allNum[i].Substring(1, 1))
&&
Convert.ToInt32(allNum[i].Substring(2, 1)) > Convert.ToInt32(allNum[i].Substring(1, 1))
)
{
result.Add(allNum[i]);
}
}
List<string> result1 = result.Distinct().ToList();//去除重复项
return result1.ToArray();
}
示例2: longTouFengWei
//.........这里部分代码省略.........
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());
}
}
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());
}
}
List<string> temp = new List<string>();
temp.AddRange(chaHe());
for (int i = 0; i < result.Count(); i++)
{
temp.Remove(result[i]);
}
result.Clear();
result.AddRange(temp);
}
if (nums == 0)
{
result.AddRange(chaHe());
}
List<string> result1 = result.Distinct().ToList();//去除重复项
return result1.ToArray();
}
示例3: sumZhi
//和值
public string[] sumZhi()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
string[] allNum = locChaExecute();
if (this.killHeZhi.Checked == false)
{
List<int> nums = new List<int>();
foreach (Control ctls in this.sumZhiGbp.Controls)
{
if ((ctls as CheckBox).Checked == 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 allNumSum = Convert.ToInt32(allNum[i].Substring(0, 1)) + Convert.ToInt32(allNum[i].Substring(1, 1)) + Convert.ToInt32(allNum[i].Substring(2, 1));
if (
allNumSum == 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.sumZhiGbp.Controls)
{
if ((ctls as CheckBox).Checked == 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 allNumSum = Convert.ToInt32(allNum[i].Substring(0, 1)) + Convert.ToInt32(allNum[i].Substring(1, 1)) + Convert.ToInt32(allNum[i].Substring(2, 1));
if (
allNumSum == nums[j]
)
{
result.Remove(allNum[i]);
}
}
}
}
List<string> result1 = result.Distinct().ToList();//去除重复项
return result1.ToArray();
}
}
示例4: allAoTu
/// <summary>
/// 凹凸升降平综合控制
/// </summary>
/// <returns></returns>
private string[] allAoTu()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
if (aoCbx.Checked == true)
{
result.AddRange(ao());
}
if (tuCbx.Checked == true)
{
result.AddRange(tu());
}
if (shengCbx.Checked == true)
{
result.AddRange(sheng());
}
if (jiangCbx.Checked == true)
{
result.AddRange(jiang());
}
if (pingCbx.Checked == true)
{
result.AddRange(ping());
}
if (aoCbx.Checked == false && tuCbx.Checked == false && shengCbx.Checked == false && jiangCbx.Checked == false && pingCbx.Checked == false)
{
result.AddRange(linMa());
}
List<string> result1 = result.Distinct().ToList();//去除重复项
result1.Sort();//排序
return result1.ToArray();
}
示例5: pingHengZhiShu
//平衡指数
public string[] pingHengZhiShu()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
string[] allNum = fanBianQiuCal();
int overMy = 0;
List<int> nums = new List<int>();
foreach (Control ctls in this.pHZSGpb.Controls)
{
bool isNum = isNumber(ctls.Text);
if (ctls is CheckBox)
{
if ((ctls as CheckBox).Checked == true && isNum == true)
{
nums.Add(Convert.ToInt16(ctls.Text));
}
}
}
if (nums.Count == 1)
{
if (nums.Contains(1))
{
if (jiaCkb.Checked == true)
{
overMy++;
result.AddRange(phJia());
}
if (jianCkb.Checked == true)
{
overMy++;
result.AddRange(phJian());
}
if (dengCkb.Checked == true)
{
overMy++;
result.AddRange(phDeng());
}
}
if (nums.Contains(0))
{
if (jiaCkb.Checked == true)
{
overMy++;
result.AddRange(phJia());
}
if (jianCkb.Checked == true)
{
overMy++;
result.AddRange(phJian());
}
if (dengCkb.Checked == true)
{
overMy++;
result.AddRange(phDeng());
}
List<string> temp = new List<string>();
temp.AddRange(chaHe());
for (int i = 0; i < result.Count(); i++)
{
temp.Remove(result[i]);
}
result.Clear();
result.AddRange(temp);
}
}
if (nums.Count == 2)
{
result.AddRange(allNum);
}
if (overMy == 0)
result.AddRange(allNum);
List<string> result1 = result.Distinct().ToList();//去除重复项
result1.Sort();
return result1.ToArray();
}
示例6: heZhi
//合值
private string[] heZhi()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
string[] allNum = f3Data;
List<int> nums = new List<int>();
foreach (Control ctls in this.heZhiGpb.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 allNumSum = Convert.ToInt32(allNum[i].Substring(0, 1)) + Convert.ToInt32(allNum[i].Substring(1, 1)) + Convert.ToInt32(allNum[i].Substring(2, 1));
if (
allNumSum.ToString().Substring(allNumSum.ToString().Length - 1, 1) == nums[j].ToString()
)
{
result.Add(allNum[i]);
}
}
}
}
else
{
result.AddRange(allNum);
}
List<string> result1 = result.Distinct().ToList();//去除重复项
return result1.ToArray();
}
示例7: fenJieShi
//.........这里部分代码省略.........
{
int a1 = Convert.ToInt32(allNum[i].Substring(0, 1)), b1 = Convert.ToInt32(allNum[i].Substring(1, 1)), c1 = Convert.ToInt32(allNum[i].Substring(2, 1));
int a2 = Convert.ToInt32(allNum[i].Substring(0, 1)), b2 = Convert.ToInt32(allNum[i].Substring(1, 1)), c2 = Convert.ToInt32(allNum[i].Substring(2, 1));
if ((((Convert.ToInt32(allNum[i].Substring(0, 1)) % 2) == 0) && ((Convert.ToInt32(allNum[i].Substring(1, 1)) % 2) == 0) && ((Convert.ToInt32(allNum[i].Substring(2, 1)) % 2) == 0))
|| (((Convert.ToInt32(allNum[i].Substring(0, 1)) % 2) == 1) && ((Convert.ToInt32(allNum[i].Substring(1, 1)) % 2) == 1) && ((Convert.ToInt32(allNum[i].Substring(2, 1)) % 2) == 1))
|| (((a1 == 1) || (a1 == 2) || (a1 == 3) || (a1 == 5) || (a1 == 7))
&& ((b1 == 1) || (b1 == 2) || (b1 == 3) || (b1 == 5) || (b1 == 7))
&& ((c1 == 1) || (c1 == 2) || (c1 == 3) || (c1 == 5) || (c1 == 7)))
||
(((a2 == 0) || (a2 == 4) || (a2 == 6) || (a2 == 8) || (a2 == 9))
&& ((b2 == 0) || (b2 == 4) || (b2 == 6) || (b2 == 8) || (b2 == 9))
&& ((c2 == 0) || (c2 == 4) || (c2 == 6) || (c2 == 8) || (c2 == 9))))
{
allNum[i] = "";
}
ans += allNum[i];
result.Add(allNum[i]);
}
}
if (fenJieShi.Contains("单双分解") && fenJieShi.Contains("大小分解") && fenJieShi.Length == 8)
{
for (int i = 0; i < allNum.Count(); i++)
{
int a1 = Convert.ToInt32(allNum[i].Substring(0, 1)), b1 = Convert.ToInt32(allNum[i].Substring(1, 1)), c1 = Convert.ToInt32(allNum[i].Substring(2, 1));
int a2 = Convert.ToInt32(allNum[i].Substring(0, 1)), b2 = Convert.ToInt32(allNum[i].Substring(1, 1)), c2 = Convert.ToInt32(allNum[i].Substring(2, 1));
if ((((Convert.ToInt32(allNum[i].Substring(0, 1)) % 2) == 0) && ((Convert.ToInt32(allNum[i].Substring(1, 1)) % 2) == 0) && ((Convert.ToInt32(allNum[i].Substring(2, 1)) % 2) == 0))
|| (((Convert.ToInt32(allNum[i].Substring(0, 1)) % 2) == 1) && ((Convert.ToInt32(allNum[i].Substring(1, 1)) % 2) == 1) && ((Convert.ToInt32(allNum[i].Substring(2, 1)) % 2) == 1))
|| ((a1 < 5) && (b1 < 5) && (c1 < 5)) || ((a2 > 4) && (b2 > 4) && (c2 > 4))
)
{
allNum[i] = "";
}
ans += allNum[i];
result.Add(allNum[i]);
}
}
if (fenJieShi.Contains("大小分解") && fenJieShi.Contains("质合分解") && fenJieShi.Length == 8)
{
for (int i = 0; i < allNum.Count(); i++)
{
int a1 = Convert.ToInt32(allNum[i].Substring(0, 1)), b1 = Convert.ToInt32(allNum[i].Substring(1, 1)), c1 = Convert.ToInt32(allNum[i].Substring(2, 1));
int a2 = Convert.ToInt32(allNum[i].Substring(0, 1)), b2 = Convert.ToInt32(allNum[i].Substring(1, 1)), c2 = Convert.ToInt32(allNum[i].Substring(2, 1));
if (((a1 < 5) && (b1 < 5) && (c1 < 5)) || ((a2 > 4) && (b2 > 4) && (c2 > 4))
|| (((a1 == 1) || (a1 == 2) || (a1 == 3) || (a1 == 5) || (a1 == 7))
&& ((b1 == 1) || (b1 == 2) || (b1 == 3) || (b1 == 5) || (b1 == 7))
&& ((c1 == 1) || (c1 == 2) || (c1 == 3) || (c1 == 5) || (c1 == 7)))
||
(((a2 == 0) || (a2 == 4) || (a2 == 6) || (a2 == 8) || (a2 == 9))
&& ((b2 == 0) || (b2 == 4) || (b2 == 6) || (b2 == 8) || (b2 == 9))
&& ((c2 == 0) || (c2 == 4) || (c2 == 6) || (c2 == 8) || (c2 == 9)))
)
{
allNum[i] = "";
}
ans += allNum[i];
result.Add(allNum[i]);
}
}
if (fenJieShi.Contains("单双分解") && fenJieShi.Contains("大小分解") && fenJieShi.Contains("质合分解") && fenJieShi.Length == 12)
{
for (int i = 0; i < allNum.Count(); i++)
{
int a1 = Convert.ToInt32(allNum[i].Substring(0, 1)), b1 = Convert.ToInt32(allNum[i].Substring(1, 1)), c1 = Convert.ToInt32(allNum[i].Substring(2, 1));
int a2 = Convert.ToInt32(allNum[i].Substring(0, 1)), b2 = Convert.ToInt32(allNum[i].Substring(1, 1)), c2 = Convert.ToInt32(allNum[i].Substring(2, 1));
if ((((Convert.ToInt32(allNum[i].Substring(0, 1)) % 2) == 0) && ((Convert.ToInt32(allNum[i].Substring(1, 1)) % 2) == 0) && ((Convert.ToInt32(allNum[i].Substring(2, 1)) % 2) == 0))
|| (((Convert.ToInt32(allNum[i].Substring(0, 1)) % 2) == 1) && ((Convert.ToInt32(allNum[i].Substring(1, 1)) % 2) == 1) && ((Convert.ToInt32(allNum[i].Substring(2, 1)) % 2) == 1))
|| ((a1 < 5) && (b1 < 5) && (c1 < 5)) || ((a2 > 4) && (b2 > 4) && (c2 > 4))
|| (((a1 == 1) || (a1 == 2) || (a1 == 3) || (a1 == 5) || (a1 == 7))
&& ((b1 == 1) || (b1 == 2) || (b1 == 3) || (b1 == 5) || (b1 == 7))
&& ((c1 == 1) || (c1 == 2) || (c1 == 3) || (c1 == 5) || (c1 == 7)))
||
(((a2 == 0) || (a2 == 4) || (a2 == 6) || (a2 == 8) || (a2 == 9))
&& ((b2 == 0) || (b2 == 4) || (b2 == 6) || (b2 == 8) || (b2 == 9))
&& ((c2 == 0) || (c2 == 4) || (c2 == 6) || (c2 == 8) || (c2 == 9)))
)
{
allNum[i] = "";
}
ans += allNum[i];
result.Add(allNum[i]);
}
}
List<string> result1 = result.Distinct().ToList();//去除重复项
result1.Sort();
for (int i = 0; i < result1.Count; i++)
{
if (result1[i].Equals(""))
{
result1.Remove(result1[i]);
}
}
return result1.ToArray();
}
示例8: numberPro
//.........这里部分代码省略.........
result.Add(allNum[i]);
}
}
}
else if (ctls.Name.Equals("ds2"))
{
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 (
(danNums.Contains(a) && danNums.Contains(b) && !danNums.Contains(c))
||
(!danNums.Contains(a) && danNums.Contains(b) && danNums.Contains(c))
||
(danNums.Contains(a) && !danNums.Contains(b) && danNums.Contains(c))
)
{
result.Add(allNum[i]);
}
}
}
else if (ctls.Name.Equals("xs2"))
{
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))
||
(!xiaoNums.Contains(a) && xiaoNums.Contains(b) && xiaoNums.Contains(c))
||
(xiaoNums.Contains(a) && !xiaoNums.Contains(b) && xiaoNums.Contains(c))
)
{
result.Add(allNum[i]);
}
}
}
if (ctls.Name.Equals("zs3"))
{
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 (
(zhiNums.Contains(a) && zhiNums.Contains(b) && zhiNums.Contains(c))
)
{
result.Add(allNum[i]);
}
}
}
else if (ctls.Name.Equals("ds3"))
{
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 (
(danNums.Contains(a) && danNums.Contains(b) && danNums.Contains(c))
)
{
result.Add(allNum[i]);
}
}
}
else if (ctls.Name.Equals("xs3"))
{
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]);
}
}
}
}
}
if (cbkCount == 0)
{
result.AddRange(allNum);
}
List<string> result1 = result.Distinct().ToList();//去除重复项
result1.Sort();
return result1.ToArray();
}
示例9: daXiao
//临码之大小
private string[] daXiao()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
string[] allNum = shaQiHao();
string[] bigNum = { "4", "5" };
if (daXiaoCbx.Checked == false)
{
result.AddRange(allNum);
}
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: linMa
/// <summary>
/// 临码综合控制
/// </summary>
/// <returns></returns>
private string[] linMa()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
if (linMaBaoHanCbx.Checked == false && linMaShaQuCbx.Checked == false)
{
result.AddRange(shaQiHao());
}
string nums = "";
foreach (Control ctls in this.lmGpb.Controls)
{
if (ctls is CheckBox)
{
if ((ctls as CheckBox).Checked == true)
{
nums += ctls.Text;
}
}
}
if (nums.Length > 0 && (linMaBaoHanCbx.Checked == true || linMaShaQuCbx.Checked == true))
{
//勾选“包含”
if (linMaBaoHanCbx.Checked == true)
{
if (daLinCbx.Checked == true)
{
result.AddRange(daLin());
}
if (xiaoLinCbx.Checked == true)
{
result.AddRange(xiaoLin());
}
if (daXiaoCbx.Checked == true)
{
result.AddRange(daXiao());
}
if (zhiLinCbx.Checked == true)
{
result.AddRange(zhiLin());
}
if (heLinCbx.Checked == true)
{
result.AddRange(heLin());
}
if (zhiHeCbx.Checked == true)
{
result.AddRange(zhiHe());
}
if (duanLinCbx.Checked == true)
{
result.AddRange(duanLin());
}
}
//勾选“杀去”
if (linMaShaQuCbx.Checked == true)
{
result.AddRange(duanLinSha());
}
}
else
{
result.AddRange(shaQiHao());
}
List<string> result1 = result.Distinct().ToList();//去除重复项
return result1.ToArray();
}
示例11: cusFJS2
//自定义分解式2
private string[] cusFJS2()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
string[] allNum = cusFJS1();
if (cusFJTbx2.Text.Length == 0 && cusFJTbx2Auto.Text.Length == 0)
{
result.AddRange(allNum);
}
if (cusFJTbx2.Text.Length > 0 && cusFJTbx2Auto.Text.Length > 0)
{
string cusFJtxt = cusFJTbx2.Text;
string cusFJtxtAuto = cusFJTbx2Auto.Text;
for (int i = 0; i < allNum.Count(); i++)
{
for (int j = 0; j < cusFJtxt.Length; j++)
if (
//必须只能出现1,2次
(allNum[i].Replace(cusFJtxt.Substring(j, 1), "|").Split('|').Length - 1 == 1 || allNum[i].Replace(cusFJtxt.Substring(j, 1), "|").Split('|').Length - 1 == 2)
&&
//所出数字不同同时都满足属于输入分解式的数字
!(cusFJtxt.Contains(allNum[i].Substring(0, 1)) && cusFJtxt.Contains(allNum[i].Substring(1, 1)) && cusFJtxt.Contains(allNum[i].Substring(2, 1)))
)
{
result.Add(allNum[i]);
}
}
}
List<string> result1 = result.Distinct().ToList();//去除重复项
return result1.ToArray();
}
示例12: noLocHeExecute
//.........这里部分代码省略.........
if (c is CheckBox)
{
if ((c as CheckBox).Checked)
{
noLocItems1.Add((c as CheckBox).Text);
}
}
}
}
if (ct is GroupBox && ct.Text.Equals("两码和2"))
{
foreach (Control c in ct.Controls)
{
if (c is CheckBox)
if ((c as CheckBox).Checked)
noLocItems2.Add((c as CheckBox).Text);
}
}
}
}
}
for (int i = 0; i < allNum.Count(); i++)
{
for (int j = 0; j < noLocItems1.Count; j++)
{
string v1 = (Convert.ToInt32(allNum[i].Substring(0, 1)) + Convert.ToInt32(allNum[i].Substring(1, 1))).ToString();
string v2 = (Convert.ToInt32(allNum[i].Substring(0, 1)) + Convert.ToInt32(allNum[i].Substring(2, 1))).ToString();
string v3 = (Convert.ToInt32(allNum[i].Substring(1, 1)) + Convert.ToInt32(allNum[i].Substring(2, 1))).ToString();
if (
(((noLocItems1.Contains(v1.Substring(v1.Length - 1, 1)))
||
(noLocItems1.Contains(v2.Substring(v2.Length - 1, 1)))
||
(noLocItems1.Contains(v3.Substring(v3.Length - 1, 1))))
&&
!((noLocItems2.Contains(v1.Substring(v1.Length - 1, 1)))
||
(noLocItems2.Contains(v2.Substring(v2.Length - 1, 1)))
||
(noLocItems2.Contains(v3.Substring(v3.Length - 1, 1)))))
||
(((noLocItems2.Contains(v1.Substring(v1.Length - 1, 1)))
||
(noLocItems2.Contains(v2.Substring(v2.Length - 1, 1)))
||
(noLocItems2.Contains(v3.Substring(v3.Length - 1, 1))))
&&
!((noLocItems1.Contains(v1.Substring(v1.Length - 1, 1)))
||
(noLocItems1.Contains(v2.Substring(v2.Length - 1, 1)))
||
(noLocItems1.Contains(v3.Substring(v3.Length - 1, 1)))))
)
{
result.Add(allNum[i]);
}
if (
v1.Substring(v1.Length - 1, 1).Equals(noLocItems1[j])
||
v2.Substring(v2.Length - 1, 1).Equals(noLocItems1[j])
||
v3.Substring(v3.Length - 1, 1).Equals(noLocItems1[j])
)
{
for (int k = 0; k < noLocItems2.Count; k++)
{
if (
v1.Substring(v1.Length - 1, 1).Equals(noLocItems2[k])
||
v2.Substring(v2.Length - 1, 1).Equals(noLocItems2[k])
||
v3.Substring(v3.Length - 1, 1).Equals(noLocItems2[k])
)
{
result.Add(allNum[i]);
}
}
}
}
}
}
#endregion
#region 选择出0,1,2
if (noLocChuGeShu.Contains("0") && noLocChuGeShu.Contains("1") && noLocChuGeShu.Contains("2"))
{
result.AddRange(allNum);
}
#endregion
List<string> result1 = result.Distinct().ToList();//去除重复项
result1.Sort();//排序
return result1.ToArray();
}
示例13: locChaExecute
//.........这里部分代码省略.........
if (locChuGeShu.Length == 3 && (locChuGeShu.Contains("0") && locChuGeShu.Contains("2") && locChuGeShu.Contains("3")))
{
foreach (Control ctl in this.locBaiShiCha.Controls)
{
if (ctl is CheckBox)
{
if ((ctl as CheckBox).Checked)
{
locItems1.Add((ctl as CheckBox).Text);
}
}
}
foreach (Control ctl in this.locBaiGeCha.Controls)
{
if (ctl is CheckBox)
{
if ((ctl as CheckBox).Checked)
{
locItems2.Add((ctl as CheckBox).Text);
}
}
}
foreach (Control ctl in this.locGeShiCha.Controls)
{
if (ctl is CheckBox)
{
if ((ctl as CheckBox).Checked)
{
locItems3.Add((ctl as CheckBox).Text);
}
}
}
if (locItems1.Count > 0 && locItems2.Count > 0 && locItems3.Count > 0)
{
for (int i = 0; i < allNum.Count(); i++)
{
string v1 = (Convert.ToInt32(allNum[i].Substring(0, 1)) - Convert.ToInt32(allNum[i].Substring(1, 1))).ToString();
string v2 = (Convert.ToInt32(allNum[i].Substring(0, 1)) - Convert.ToInt32(allNum[i].Substring(2, 1))).ToString();
string v3 = (Convert.ToInt32(allNum[i].Substring(1, 1)) - Convert.ToInt32(allNum[i].Substring(2, 1))).ToString();
if (
!(locItems1.Contains(v1.Substring(v1.Length - 1, 1))
||
locItems2.Contains(v2.Substring(v2.Length - 1, 1))
||
locItems3.Contains(v3.Substring(v3.Length - 1, 1)))
)
{
result.Add(allNum[i]);
}
if (
(locItems1.Contains(v1.Substring(v1.Length - 1, 1))
&&
locItems2.Contains(v2.Substring(v2.Length - 1, 1))
&&
!locItems3.Contains(v3.Substring(v3.Length - 1, 1))
)
||
(locItems3.Contains(v3.Substring(v3.Length - 1, 1))
&&
locItems2.Contains(v2.Substring(v2.Length - 1, 1))
&&
!locItems1.Contains(v1.Substring(v1.Length - 1, 1))
)
||
(locItems1.Contains(v1.Substring(v1.Length - 1, 1))
&&
locItems3.Contains(v3.Substring(v3.Length - 1, 1))
&&
!locItems2.Contains(v2.Substring(v2.Length - 1, 1))
)
)
{
result.Add(allNum[i]);
}
if (
locItems1.Contains(v1.Substring(v1.Length - 1, 1))
&&
locItems2.Contains(v2.Substring(v2.Length - 1, 1))
&&
locItems3.Contains(v3.Substring(v3.Length - 1, 1))
)
{
result.Add(allNum[i]);
}
}
}
}
#endregion
List<string> result1 = result.Distinct().ToList();//去除重复项
result1.Sort();
return result1.ToArray();
}
示例14: phJian
//平衡减
private string[] phJian()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
string[] allNum = fanBianQiuCal();
if (jianCkb.Checked == true)
{
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));
int leftvv = (10 - a + b);
int rightvv = (10 - b + c);
if (leftvv < rightvv)
{
result.Add(allNum[i]);
}
}
}
List<string> result1 = result.Distinct().ToList();//去除重复项
result1.Sort();
return result1.ToArray();
}
示例15: pingMianBiChu4
//平面胆码组四
private string[] pingMianBiChu4()
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
List<string> pingMianBiChu = new List<string>();
List<string> pingMianBiChuGeShu = new List<string>();
foreach (Control ctl in this.groupBox11.Controls) //this可以根据实际情况修改为this.groupBreakFast,this.groupLunch,this.groupDinner
{
if (ctl is CheckBox)
{
if ((ctl as CheckBox).Checked == true)
{
if (!ctl.Name.Contains("fourZu"))
{
pingMianBiChu.Add((ctl as CheckBox).Text);
}
if (ctl.Name.Contains("fourZu"))
{
pingMianBiChuGeShu.Add((ctl as CheckBox).Text);
}
}
}
}
List<string> allNum = new List<string>();
allNum.AddRange(pingMianBiChu3());
result.AddRange(pingMianDanMaOutput(allNum, pingMianBiChu, pingMianBiChuGeShu));
List<string> result1 = result.Distinct().ToList();//去除重复项
return result1.ToArray();
}