---
title: "StringOfArray in web service proxy"
author: "huhu_long"
date: "2012-09-29T00:09:39Z"
tags: ["ArrayOfString", "WebService"]
categories: ["编程语言"]
slug: "stringofarray-in-web-service-proxy"
draft: false
lastmod: "2012-09-29T00:09:39Z"
id: 1688298
url: "https://vrplat.iteye.com/blog/1688298"
---

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 \[code="C#"] public class ArrayOfString : System.Collections.Generic.List { } private static T To(IEnumerable strings) where T : IList, 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(strings); \[/code]