Monday, March 22, 2004

ArrayList Method to Array

ArrayList a = new ArrayList();
a.Add(4);
a.Add(5);
a.Add(6);
a.Add(7);
a.Add(8);

int [] arr = new int[a.Count];
int cntr = 0;

arr = (int []) a.ToArray(typeof(int));

foreach ( int n in arr )
{
Console.WriteLine(n.ToString());
}

Friday, March 19, 2004

very good site for patterns

http://www.dofactory.com/Patterns/Patterns.aspx#list

some language dictonories


dic hebrew - english: http://milon.morfix.co.il/MorDictFirstPage.htm

dic deutsch - englisch: http://dict.leo.org/

Some ideas how to iterate throw Controls

Some ideas:

A) use FindControl on the object you added your control to:

Control empPeriod = this.LoadControl("EmploymentPeriod.ascx");
empPeriod.id="empPeriodId";
emp1.Controls.Add(empPeriod);
.Control empPeriod1 = empPeriod.FindControl("empPeriodId");


B) create an arraylist of the controls you've added, then use that later:

ArrayList list = new ArrayList();
for (i = 0; i < 10; i++)
{
Control empPeriod = this.LoadControl("EmploymentPeriod.ascx");
list.Add(empPeriod);
emp1.Controls.Add(empPeriod);
}

...

for (i = 0; i < 10; i++)
{
Control empPeriod1 = (Control)list[i];
......
}

C) do a recursive search for your controls

public void iterate(Control c)
{
if (c is YourType)
{
do_something(c);
}
forech (Control c1 in c.Controls)
{
iterate(c1);
}
}

Shared Cache - .Net Caching made easy

All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.

Facebook Badge