I have the following class:
public class SimContactDetails2G
{
public String AbreviatedName { get; set; }
public String DialingNumber { get; set; }
public int Index { get; set; }
public String Surname { get; set; }
public SimContactDetails2G()
{
}
public SimContactDetails2G(String name, String phoneNumber)
{
AbreviatedName = name;
DialingNumber = phoneNumber;
}
}
i want to create a list of the above objects. so i do,
List<SimContactDetails2G> simContactDetails2GToBackUp = new List<SimContactDetails2G>();
However, when I try to retrieve the count of items on the variable "simContactDetails2GToBackUp
", it gives the folwing error:
Count =
'((System.Collections.Generic.List<T>)(simContactDetails2GToBackUp)).Count'
threw an exception of type
'System.ArgumentException'
the program does not crash, but I cant access the count property. I can add items on the list, the list is populated. But I can't get the count. Any idea for this strange behaviour?