M
MC D
Hi,
I'm trying to write a class that inherits from
System.Collections.CollectionBase, and I want to expose the Item property
for both Get and Set. However because C# doesn't support property
parameters, I can NOT do the following:
public TabData Item(int index)
{
get
{
return (TabData)List[index];
}
set
{
(TabData)List[index] = value;
}
}
In my code I want to be able to write "myCollection = x" , as well as "x
= myCollection", so how can this be done?
I know that you could create a function that sets it, OR returns it, but the
above methodology is so common there must be a way...
-D
(a former VB guy)
I'm trying to write a class that inherits from
System.Collections.CollectionBase, and I want to expose the Item property
for both Get and Set. However because C# doesn't support property
parameters, I can NOT do the following:
public TabData Item(int index)
{
get
{
return (TabData)List[index];
}
set
{
(TabData)List[index] = value;
}
}
In my code I want to be able to write "myCollection = x" , as well as "x
= myCollection", so how can this be done?
I know that you could create a function that sets it, OR returns it, but the
above methodology is so common there must be a way...
-D
(a former VB guy)