Advertisement
Advertisement
| 12.20.2007 at 01:41AM PST, ID: 23035405 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
| Microsoft |
| Apple |
| Internet |
| Gamers |
| Digital Living |
| Virus & Spyware |
| Hardware |
| Software |
| ITPro |
| Developer |
| Storage |
| OS |
| Database |
| Security |
| Programming |
| Web Development |
| Networking |
| Other |
| Community Support |
| 12.20.2007 at 07:07AM PST, ID: 20507137 |
| 12.28.2007 at 02:06AM PST, ID: 20540751 |
| 12.28.2007 at 08:11AM PST, ID: 20542762 |
| 01.01.2008 at 07:09AM PST, ID: 20559933 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: |
public void LoadSampleData()
{
//create and populate the tables: from the database or using linqtosql
List<ARecord> table1 = new List<ARecord>(); //no from 1 to 20
for (int i = 1; i <= 20; i++)
table1.Add(new ARecord(i, i * 5));
List<ARecord> table2 = new List<ARecord>(); //even numbers;
for (int i = 1; i <= 20; i++)
if (i % 2 == 0)
table2.Add(new ARecord(i, i * 2));
List<ARecord> table3 = new List<ARecord>(); //multiples of 3
for (int i = 1; i <= 20; i++)
if (i % 3 == 0)
table3.Add(new ARecord(i, i * 3));
//DateTime dt = DateTime.Now;
//TimeSpan elapsed1, elapsed2;
//int total=10;
//for (int i = 0; i < total; i++)
//{
listBox1.DataSource = CalcWithFirst(table1, table2, table3).ToList();
//}
//elapsed1 = DateTime.Now - dt;
//dt = DateTime.Now;
//for (int i = 0; i < total; i++)
//{
// listBox1.DataSource = CalcWithFirst(table1, table2, table3).ToList();
//}
//elapsed2 = DateTime.Now - dt;
//MessageBox.Show(string.Format("{0}\n{1}", elapsed1.TotalSeconds, elapsed2.TotalSeconds));
}
IEnumerable<ARecord> CalcWithFirst(List<ARecord> table1, List<ARecord> table2, List<ARecord> table3)
{
var result = from r in table1
let x = (from r2 in table2 select r2.id) //select t2 ids
let y = (from r3 in table3 select r3.id) //select t3 ids
where !x.Contains(r.id) && !y.Contains(r.id) //not in 2 and 3
select r;
return result;
}
IEnumerable<ARecord> CalcWithSecond(List<ARecord> table1, List<ARecord> table2, List<ARecord> table3)
{
var result = from r in table1
let x = (from r2 in table2 where r2.id == r.id select r2.id).Count()
let y = (from r3 in table3 where r3.id == r.id select r3.id).Count()
where x == 0 && y == 0
select r;
return result;
}
private void button1_Click(object sender, EventArgs e)
{
LoadSampleData();
}
|
| 01.01.2008 at 07:12AM PST, ID: 20559959 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: |
struct ARecord
{
public int id;
public int value;
public ARecord(int id, int value)
{
this.id = id;
this.value = value;
}
public override string ToString()
{
return id.ToString();
}
}
|