I have a control with a public array property and the array is assigned to default values. I'd like to allow the ASP.NET code to reassign a value within the array. I'm not sure of the ASP.NET syntax for array properties.<BR>Example:<BR>public class MyControl: Control<BR>{<BR> private Color[] fColors = {Color.Red, Color.Black, Color.Green};<BR> public Color[] xColors<BR> { get( return fColors; } }<BR>} // end class<BR><BR>ASP.NET:<BR><Pref:MyControl id="MyID" runat="server" xColors[0]="Blue" /><BR>Since xColors[0] doesn't work, what does work?<BR><BR>--- PeterPart of your problem is that you've only defined a getter ( a public get method for the property ) so you have no way of assigning a new value to the private fColors array. Here's a new version of your code that includes a setter method definition:<BR><BR>public class MyControl : Control <BR>{ <BR> private Color[] fColors = {Color.Red, Color.Black, Color.Green}; <BR> public Color[] xColors <BR> { <BR> get( return fColors ; ) <BR> set( fColors = value ; ) <BR> } <BR>} // end class <BR><BR>See how I added a *setter* into the public property definition? The getter enables you to <BR>get the hashtable (duh!) and the setter enables you to update it. <BR><BR>In your ASP page you could do something akin to this:<BR><BR>' Server-side code<BR>------------------------<BR>Color[] myColors = MyID.xColors ; // retrieve the array<BR>myColors[0] = Color.Blue ; // update the element<BR>MyID.xColors = myColors ; // set the property of the control<BR><BR><BR>' Webcontrol definition<BR>------------------------<BR><Pref:MyControl id="MyID" runat="server" /> <BR><BR>This is totally untested, but I hope that it will give you some idea of how it should work. Please lookup the correct syntax for these methods in MSDN or on http://samples.gotdotnet.com/quickstart.<BR><BR>If you'd like to see an even cooler way, do a search in MSDN on C# indexers OR VB Default Properties, they will allow you to write code similar to this:<BR><BR>' Server-side code<BR>------------------------<BR>(Color) MyID[0] = Color.Blue ;Digory,<BR><BR>Thank you for taking the time to answer my question. I have two concerns with your answer:<BR>1. I used a readonly (GET) property because I was thinking that the array is another object, already created by the "new" operator. (int[] vMyInt = new int[10])<BR>Thus the GET returns the reference to the object. The caller needs to retrieve the reference to the object then use its methods, of which the [] is an overloaded operator. The only reason to supply a SET function is when you intend to allow the user to reassign the entire array object. Do you agree?<BR><BR>2. I was hoping for the syntax of the ASP.NET code within the<BR><asp:control id=...> line for assigning a value to an array or a confirmation that this isn't possible.<BR><BR>I have also looked at Indexers and while they seem appropriate, they have several problems:<BR>1. They have a fixed naming scheme, limiting their clarity.<BR>2. There can only be one per class.<BR>3. I cannot find the ASP.NET syntax for them either.<BR><BR>Any direction would be greatly appreciated.<BR><BR>--- PeterPeter,<BR><BR>> The only reason to supply a SET function is when you <BR>> intend to allow the user to reassign the entire array <BR>> object. Do you agree?<BR><BR> Yep, I do agree... see what happens when I talk <BR> about something I don't understand.<BR><BR>> I was hoping for the syntax of the ASP.NET code within <BR>> the <asp:control id=...> line for assigning a value to <BR>> an array or a confirmation that this isn't possible.<BR><BR> Well, in light of what I've said previously, I probably<BR> shouldn't comment, but, I'm pretty sure that it isn't <BR> possible.<BR><BR>> 3. I cannot find the ASP.NET syntax for them either.<BR><BR> This I can help you with ( for VB anyways )...<BR><BR>--------------------------------------<BR> CODE INSIDE YOUR USER CONTROL<BR>--------------------------------------<BR><BR> Private fColors As System.Drawing.Color() = {Color.Red, Color.Black, Color.Green}<BR><BR> Public ReadOnly Property xColors() As System.Drawing.Color()<BR> Get<BR> Return fColors<BR> End Get<BR> End Property<BR><BR> Default Public Property Colors(ByVal Item As Int32) As System.Drawing.Color<BR> Get<BR> Return fColors(Item)<BR> End Get<BR> Set(ByVal Value As System.Drawing.Color)<BR> fColors(Item) = Value<BR> End Set<BR> End Property<BR><BR>--------------------------------------<BR> CONSUMING CODE<BR>--------------------------------------<BR><BR>' USING THE PUBLIC (PARAMETERLESS) PROPERTY<BR>Dim myColors As Color() = MyID.xColors<BR>myColors(0) = Color.Blue<BR><BR>' USING THE DEFAULT (PARAMETERFUL) PROPERTY<BR>MyID(0) = Color.Blue<BR><BR>--------------------------------------<BR><BR>Parameterful properties (indexers and default properties) are well covered in the MSPress book titled "OOP with VB.NET and C# Step by Step":<BR> http://www.amazon.com/exec/obidos/ASIN/0735615683/forestlakewebser/