I don't understand how a compiler can be smart enough to construct an O(1) lookup for MyObject
where I can put anything inside
public class MyObject
{
// ...
}
I understand how this can be done for a limited number of non-primitives such as
public class MyObject
{
int i { get; set; }
char c { get; set; }
}
but how can it possibly know how to do this for any implementation of MyObject
?