, . , , = , # "", ... . Steffen Wrapper , . , .
Wrapper<T> , , :
public class CustomerTable
{
private Wrapper<string> _Name;
public Wrapper<string> Name {
get { return _Name; }
set { _Name = (string)value; }
}
}
public class UserTable
{
private Wrapper<string> _Name;
public Wrapper<string> Name {
get { return _Name; }
set { _Name = (string)value; }
}
}
If this change were made, it would not violate the existing code, since it still allows various ways to set the property:
CustomerTable customer = new CustomerTable();
UserTable user = new UserTable();
user.Name = customer.Name;
user.Name = "string literal";
user.Name = (string)customer.Name;
user.Name = customer.Name.Value;
Since this still does not answer the original question, using the Wrapper class can be problematic if it is used outside the context of a class property, i.e. passed between an object, etc. Perhaps the entire Wrapper class could be eliminated with the correct class, including using a set of properties / accesses.
source
share