No. While C# 4.0 introduces the concept of variance for interfaces, it isn't (and can't be) possible to do what you're asking specifically.
In C# 4.0, you can do this:
IEnumerable<object> foo = new List<int>();
Edit: As Marc points out, this can't be done with value types and reference Types. However, since I think your question was more about a generalized A:B
than it was about int:object
, I think the point carries. To be accurate, though, what I mean is that C# 4.0 will allow something this:
IEnumerable<object> foo = new List<string>();
But you can't do what you describe. Namely, let's consider:
List<int> foo = new List<int>();
List<object> bar = foo;
bar.Add("baz");
Now, what happens when we try to access foo[0]
? You've now broken the type safety on the list.