StringOfArray in web service proxy
Sometimes we may need reference web service hosted base on java platform. And you are very likely to generate proxy classes with class type "ArrayOf***". So we may have to convert these types to collection or other appropriate type in our own application, and our types to "ArrayOf***".
Here is a sample to convert string to ArrayOfString
public class ArrayOfString : System.Collections.Generic.List<string>
{
}
private static T To<T>(IEnumerable<string> strings) where T : IList<string>, new()
{
if (strings == null) return default(T);
var tResult = new T();
foreach (var s in strings) tResult.Add(s);
return tResult;
}
var strings = new string[] {"aaa", "BBB", "ccc", "DDD"};
var arrayOfString = To<ArrayOfString>(strings);
:arrow:
撒大大 8)
:o :cry: :cry: :twisted: :evil: :arrow:
<> ||
|| 阿迪was