from my understanding i implement the proxy pattern when i hold a reference to another type as a member in my Proxy class. i also need to provides an interface, identical to the subject type, and Controls access to the real object.
so, if my code was to look like this, when the List member is the subject type, would i have been implementing the proxy pattern correctly?
public class ListUsers
{
public List<User> UserList { get; set; }
.
.
// Ctor and other methods that dont expose the "List<Users>" properties..
.
.
public void Add(User i_User)
{
// added logic and control.
if (!this.UserList.Exists(x => x.Id == i_User.Id))
{
this.UserList.Add(i_User);
this.SetUserPassword();
}
else
{
.
.
.
}
}
}
also, if my description i correct, would that make any class who has any kind of member into a proxy pattern class??