I have an object called Reservations. Inside Reservations, there is a another object called Reservation that is an array.
When I do something like the following:
reservations.Reservation[i] = new Reservation(); //reservations if of type Reservations I get the following error:
Cannot find the method on the object instance
A couple things I noticed is that when I get to this point, it throws an IndexOutOfRangeError and if I hover over the reservations variable, it shows a number.
VB Code
Public Class Reservations { Private RerservationField() as Reservation Public Property Reservation() as Reservation() Get Return Me.ReservationField End Get Set Me.ReservationId = value End Set End Property } Dim reservations As New Reservations() ReDim reservations.Reservation(0) Dim i as Integer = 0 reservations.Reservation(i) = New Reservation() C# Code
public class Reservations { Reservation[] reservation {get;set;} } Reservations reservations = new Reservations(); reservations.Reservation = new Reservation[0]; int i = 0; The VB Code and C# Code, it is instantiating the length of the array based on an xml request. So in the vb code, it was doing this:
ReDim reservations.Reservation(rq.Reservations.Reservation.Length - 1) and in the c# code, it was doing this:
reservations.Reservation(rq.Reservations.Reservation.Length - 1). Is the above my problem. I need to do:
reservations.Reservation(rq.Reservations.Reservation.Length) rq is the request.
ioutside the bounds of that array?