E
exitus
Is there a way to dynamically resize an array along with maintaining
its contents similar to VB's REDIM PRESERVE statement in C#? My
problem is, the user won't be sure how big the string array (sTest) is
initially. As stated in the code below, when the class is
instantiated, the string array is initialized to null. Is it possible
to have the user "set" a value in the array and the object would resize
the array automatically? For instance:
using System;
namespace Class1
{
public class Class1
{
private string[] sTest;
public string[] Test
{
get { return this.sTest; }
}
public UserProxy()
{
this.sTest = null;
}
}
}
Class1 tmp = new Class1();
tmp.Test[0] = "TEST";
I want the tmp object to be able to automatically create/resize its
sTest array and/or overwrite the value at the current location
specified, without destroying any other value in the rest of the array?
In the set accessor, how can I "see" what index the user specified?
Is what I ask even possible or is there an easier way?
Any help would be greatly appreciated.
Thanks,
Exitus
its contents similar to VB's REDIM PRESERVE statement in C#? My
problem is, the user won't be sure how big the string array (sTest) is
initially. As stated in the code below, when the class is
instantiated, the string array is initialized to null. Is it possible
to have the user "set" a value in the array and the object would resize
the array automatically? For instance:
using System;
namespace Class1
{
public class Class1
{
private string[] sTest;
public string[] Test
{
get { return this.sTest; }
}
public UserProxy()
{
this.sTest = null;
}
}
}
Class1 tmp = new Class1();
tmp.Test[0] = "TEST";
I want the tmp object to be able to automatically create/resize its
sTest array and/or overwrite the value at the current location
specified, without destroying any other value in the rest of the array?
In the set accessor, how can I "see" what index the user specified?
Is what I ask even possible or is there an easier way?
Any help would be greatly appreciated.
Thanks,
Exitus