Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. interface ICopyable<T> where T : class
  2. {
  3. void CopyTo(T dst);
  4. void CopyFrom(T src);
  5. }
  6.  
  7. interface IMyCopyable : ICopyable<IMyCopyable>
  8. {
  9. int MyProp { get; set; }
  10. }
  11.  
  12. class MyCopyableClass : IMyCopyable
  13. {
  14. public int MyProp { get; set; }
  15.  
  16. public void CopyFrom(IMyCopyable src)
  17. {
  18. src.CopyTo(this);
  19. }
  20.  
  21. public void CopyTo(IMyCopyable dst)
  22. {
  23. dst.CopyFrom(this);
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement