propably you have to write one of your own arraylist by extending the
existing System.Collection.Arraylist. Also you have to override some of
existing functions.. like method "add" and "addrange" as and when it is
appropraite.
Then you may use your custom array list as a property in ur interface..
else.. you have to do a custom implimentation at the implimentation cliass
like
public System.Collections.ArrayList ListWithOnlyStringObjects
{
get
{
return the listWithOnlyStringObjects;
}
set
{
listWithOnlyStringObjects = ConvertArrayListToString(value);
}
}
private System.Collections.ArrayList listWithOnlyStringObjects = new ....
Finaly: Please note that these answers heavilly depend on your requirements,
the infomation given seems not fully explaining the objective and
requireements..
Nirosh
"Jeroen" <me******@gmail.comwrote in message
news:11*********************@m7g2000cwm.googlegrou ps.com...
I've been searching for this answer for some time now but I either
can't find the correct search in this group, or the answer's not there
yet :P Here's the problem:
I'm specifying an interface, that will have an ArrayList property (at
least, I'd very much *like* to use such a property). The only problem
is: I want the list only to accept string objects, nothing else. Can I
do this (or something alternative) in the interface? What's the
nice/'correct' solution?
This is what I have so far:
public interface ISomeInterface
{
// This list should only accept strings, but now it accepts anything.
public System.Collections.ArrayList ListWithOnlyStringObjects
{
get;
set;
}
}