コード例 #1
0
    public static void Create(Action <MyObject> assigner = null)
    {
        var newInstance = new MyObject();

        newInstance._assigner = assigner;
        newInstance.Assign();
    }
コード例 #2
0
    public void SwapWith(MyObject replacement)
    {
        var thisAssigner        = _assigner;
        var replacementAssigner = replacement._assigner;

        this._assigner        = replacementAssigner;
        replacement._assigner = thisAssigner;
        this.Assign();
        replacement.Assign();
    }
コード例 #3
0
 public void SwapWith(MyObject replacement)
 {
     replacement._assigner = Interlocked.Exchange(ref this._assigner, replacement._assigner);
     this.Assign();
     replacement.Assign();
 }