You can use the .ToArray method of the generic to convert to a string array,
but I think you have to call a bunch of Adds to populate the generic list of
strings with values from a string array. Foreach is nice and simple.
on your code you can jsut have method something like:
public List<sting> Listify(string [] strings)
{
List<string> toReturn = new List<string>();
foreach(string s in strings)
{
toReturn.Add(s);
}
return toReturn;
}
Or if you hate making the call yourself,
You can edit your proxy so that your Set method goes of whatever property
you're calling it, say "StringList" actually does the above thing by
manipulating the XmlElelment Attributes of the property
[XmlElement("StringList")] <-- xml serializer calls this guy for the
proprety
public string [] InboundStrings
{
get
{
return StringList.ToArray(typeof(System.String));
}
set
{
Listify(value);
}
}
[XmlIgnore]
public List<string> StringList <----- Your code can use this one.
{
get
{
...
}
set
{
....
}
}
"Larry Charlton" wrote:
Thanks, so is the only way to get a List<String> from a String() to write
some code or is there a built in conversion facility? The web service will
manage the conversion if in the web service I write:
Sub(ByRef List(Of String))
On the client side I must send a String(). Clearly .Net is serializing a
String() and somehow deserializing List(Of String), what I want to know is
how? I guess as a fall back I can always code a for each loop and build the
class I want, but was hoping for built in functionality.