in .net Array are fixed size, you can not change them, only create a new one.
you want a List in c#. Ther is no associative array support like javascript,
but if you need a key, data use a dictionary or hashtable.
HyperLink[] obj = new HyperLink[] {
new HyperLink(), new HyperLink(),
new HyperLink(), new HyperLink()
};
or
HyperLink[] obj = {
new HyperLink(), new HyperLink(),
new HyperLink(), new HyperLink()
};
or
var obj = new HyperLink[] {
new HyperLink(), new HyperLink(),
new HyperLink(), new HyperLink()
};
but this is probably what you are typing to do:
var listSize = 4;
for (var i = 0; i < listSize; i++)
{
var link = new HyperLink();
link.ID= "Link" + i.ToString(); // numbers not valid in html
link.Text = i.ToString();
link.NavigateUrl = i.ToString() + ".aspx";
link.BorderStyle = BorderStyle.Ridge;
Controls.Add(link);
Controls.Add(new HtmlGenericControl("br"));
}
-- bruce (sqlwork.com)