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 get the number of elements in the variable " simContactDetails2GToBackUp", this gives a folwing error:
Count = '((System.Collections.Generic.List<T>)(simContactDetails2GToBackUp)).Count' threw an exception of type 'System.ArgumentException'
The program does not crash, but I cannot access the count property. I can add items to the list, the list is populated. But I canβt get the bill. Any idea for this weird behavior?
source
share