我有一个 WCF 服务来返回客户数据。通过添加对象的新实例来创建数组列表。代码如下所示:
objCust.CUSTNUM = CustomerByNumber_CST#9A
objCust.CUSTNAME = CustomerByNumber_NAME9A
objCust.CUSTADR1 = CustomerByNumber_ADR19A
objCust.CUSTADR2 = CustomerByNumber_ADR29A
objCust.CUSTCITY = CustomerByNumber_CITY9A
objCust.CUSTSTAT = CustomerByNumber_STAT9A
objCust.CUSTZIP = CustomerByNumber_ZIPC9A
objCust.CUSTPHON = CustomerByNumber_PHON9A
aryList.Add(objCust)
然后我将数组列表作为数组返回 - aryList.ToArray(...
当我调用该服务时,数组元素按字母顺序返回 - 这是输出:
<b:CUSTADR1>3910 LAKEFIELD DR</b:CUSTADR1>
<b:CUSTADR2>JOHNS CREEK FACILITY</b:CUSTADR2>
<b:CUSTCITY>SUWANEE</b:CUSTCITY>
<b:CUSTNAME>JOHNSON CONTROLS</b:CUSTNAME>
<b:CUSTNUM>1688</b:CUSTNUM>
<b:CUSTPHON>770-495-9950</b:CUSTPHON>
<b:CUSTSTAT>GA</b:CUSTSTAT>
<b:CUSTZIP>30024</b:CUSTZIP>
我没有做任何排序。为什么这样排序?我希望它按照我添加它们的顺序。