Guest User

Untitled

a guest
May 26th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.37 KB | None | 0 0
  1. public class CanBeReadOnly<T>
  2. {
  3.     private T _value;
  4.  
  5.     public CanBeReadOnly(T value)
  6.     {
  7.         _value = value;
  8.     }
  9.  
  10.     public T Value
  11.     {
  12.         get { return _value; }
  13.         set
  14.         {
  15.             if (!IsReadOnly)
  16.             {
  17.                 _value = value;
  18.             }
  19.         }
  20.     }
  21.  
  22.     public bool IsReadOnly { get; set; }
  23. }
Add Comment
Please, Sign In to add comment