我有一个 Web 服务正在调用另一个客户端 Web 服务。
下面是我用来从中提取预订详细信息的代码。
ResMsg.GetBookingsOperationRequest request = new ResMsg.GetBookingsOperationRequest();
int noofBookings = 3;
DateTime checkInDate;
DateTime checkOutDate;
string bookingStatus;
string Notes;
int adults;
int children;
Int64 bookingID;
string bookingSource;
DateTime bookingDate;
string resResult;
using (var proxy = new ResMesg.ResonlineMsg.InventoryServiceClient())
{
var result = proxy.GetModifiedBookings(request);
ResMsg.Booking[] bookings= new ResMsg.Booking[noofBookings];
result.Bookings = new ResMesg.ResonlineMsg.Booking[noofBookings];
result.Bookings = bookings;
for (int i = 0; i < bookings.Length; i++)
{
Booking bk = new ResMesg.ResonlineMsg.Booking();
result.Bookings[i]=bk;
bookingID = bk.BookingId;
checkInDate = bk.CheckInDate;
checkOutDate = bk.CheckOutDate;
adults = bk.Adult;
children = bk.Children;
bookingStatus = bk.BookingStatus;
Notes = bk.Note;
bookingSource = bk.BookingSource;
bookingDate = bk.BookingDate;
bk.GuestInfo = new GuestDetails[noofBookings]; ** Place where error is referring to.GuestDetails is an array. GuestInfo is an instance of GuestDetails.
}
return "Success";
}
错误 1 无法将类型“ResMesg.ResonlineMsg.GuestDetails[]”隐式转换为“ResMesg.ResonlineMsg.GuestDetails”
**更新:GuestDetails 的数据类型
Field Data Type Description
Name string Guest's full name.
Address string Guest's address.
EmailAddress string Guest's email address.
PhoneNumber string Guest's phone number.
从对象浏览器中复制的 GuestDetails 的定义
public GuestDetails GuestInfo { set; get; }
(Member of Booking)
对于如何解决此错误或出现此错误的原因,我将不胜感激。谢谢