I use a function that expands an array by one element. You can modify it
slightly to suit your needs:
public static Array ExpandArray(Array arr, object newElement)
{
int length = 1;
System.Type type = newElement.GetType();
if (arr != null)
{
length += arr.Length;
type = arr.GetType().GetElementType();
}
Array result = Array.CreateInstance(type, length);
if (arr != null)
{
arr.CopyTo(result, 0);
}
result.SetValue(newElement, result.Length - 1);
return result;
}
"yoshitha" wrote:
Hi
Can any one tell me how to increase size of an array in C#.net with ASP.Net?
its very urgent for me
thanks
yoshitha