Ummm.... you are just using autoboxing here, not generics. You should try: List s = new ArrayList();
then you CAN do: List l = s;.... but I don't know why you ever would, and if you decided to do that you could THEN do:
l.add("wow");
and you get errors. Sure, if you use goto's wrong you can get errors, if you use unsafe regions in C# incorrectly you can get errors, but then again, you are not using the language as intended.
if you did: List s = new ArrayList();... and then: s.add("wow");
you get what you would expect, a compilation error.
Ummm.... you are just using autoboxing here, not generics.
.... but I don't know why you ever would, and if you decided to do that you could THEN do:
... and then:
You should try:
List s = new ArrayList();
then you CAN do:
List l = s;
l.add("wow");
and you get errors. Sure, if you use goto's wrong you can get errors, if you use unsafe regions in C# incorrectly you can get errors, but then again, you are not using the language as intended.
if you did:
List s = new ArrayList();
s.add("wow");
you get what you would expect, a compilation error.