I am trying to use invariants(code contracts library) in my program inside a carpark class where all my methods are implemented but "The name does not exist in the current context" appears.The highlighted words appeared to make the problem. The conferenceID and parkingID are coming from two different classes which are outside the CarPark Class. Here's what i tried until now.
class Program
{
public class Conferences
{
public int conferenceID { get; set; }
public Parking[] parkingArray { get; set; }
public DateTime DateTime { get; set; }
}
public class Parking
{
public int parkingID { get; set; }
public bool parkingIsReserved { get; set; }
public bool parkingIsPurchased { get; set; }
public bool parkingisReservedBy { get; set; }
public DateTime DateTime { get; set; }
}
[ContractInvariantMethod]
void ObjectInvariant()
{
Contract.Invariant(**conferenceID** >= 0 && conferenceID <= totalConferences);
Contract.Invariant(**parkingID** >= 0 && parking <= maxParkingSpaces);
Contract.Invariant(parkingID <= availableParkings);
}