E
EmperorKane
I know that I can use an indexer to pull data from an array.
data = SomeClass[0];
But what I want to see as the interface is:
data = SomeClass[0].Data
Specifically what I'm trying is this:
struct MyStruct {
string name;
int value;
}
public class MyClass()
{
MyStruct s = new MyStruct[50];
}
Main()
{
MyClass s;
s[0].Name = "Value";
s[0].Value = 1234;
value = s[0].value;
}
What I want is exactly what the listbox has for Items. It is a
collection that you would access the same way.
In the past I have used Methods to accomplish this;
SetData(int index, int data);
value = GetData(int index);
I like the way properties work and was wondering if anyone can help me
with the implementation of this code.
Thanks very much for any help
data = SomeClass[0];
But what I want to see as the interface is:
data = SomeClass[0].Data
Specifically what I'm trying is this:
struct MyStruct {
string name;
int value;
}
public class MyClass()
{
MyStruct s = new MyStruct[50];
}
Main()
{
MyClass s;
s[0].Name = "Value";
s[0].Value = 1234;
value = s[0].value;
}
What I want is exactly what the listbox has for Items. It is a
collection that you would access the same way.
In the past I have used Methods to accomplish this;
SetData(int index, int data);
value = GetData(int index);
I like the way properties work and was wondering if anyone can help me
with the implementation of this code.
Thanks very much for any help