I have a web service which is calling another client web service.
Below is my code which I am using to extract booking details from.
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";
}
Error 1 Cannot implicitly convert type
‘ResMesg.ResonlineMsg.GuestDetails[]’ to
‘ResMesg.ResonlineMsg.GuestDetails’
**Updated:
Datatype for 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.
Definition for GuestDetails copied out of the object browser
public GuestDetails GuestInfo { set; get; }
(Member of Booking)
I would be grateful for any sort of advise on how this fix this error or why it is coming. thanks
why not simply
Also lines 19,20,21 look to be doing the same thing.