I will try to explain this with a simple example. Suppose you have another class that implements IPost<User>:
class PicturePost : IPost<User>
{
// Implementation
}
Then this code will not compile:
IUser<Post> user = new User();
user.Post = new PicturePost();
Because it user.Posthas a specific class Postthat is incompatible with PicturePost(they are brothers and sisters).
Then imagine that the line from your question was successfully compiled:
// C
IUser<IPost<User>> user = new User();
user.Post IPost<User>, :
IUser<IPost<User>> user = new User();
user.Post = new PicturePost();
, ! , user.Post Post IPost PicturePost.
, # , , . , , Post :
interface IUser<PostType>
{
PostType Post { get; }
}
, Post , , .
, , , , ( , ). , ( out), :
interface IUser<out PostType>
{
PostType Post { get; }
}
IUser<IPost<User>> user = new User();
IUser<Post> user1 = new User();
, :)