Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/16/19 16:12:21 (5 years ago)
Author:
abeham
Message:

#2521: worked on refactoring PTSP

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/ValueTypeValue.cs

    r17226 r17253  
    2222using System;
    2323using System.Drawing;
     24using HEAL.Attic;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    26 using HEAL.Attic;
    2727
    2828namespace HeuristicLab.Data {
     
    6464      this.readOnly = false;
    6565    }
    66     protected ValueTypeValue(T value) {
     66    protected ValueTypeValue(T value, bool @readonly = false) {
    6767      this.value = value;
    68       this.readOnly = false;
     68      this.readOnly = @readonly;
    6969    }
    7070
    7171    public virtual ValueTypeValue<T> AsReadOnly() {
    72       ValueTypeValue<T> readOnlyValueTypeValue = (ValueTypeValue<T>)this.Clone();
    73       readOnlyValueTypeValue.readOnly = true;
    74       return readOnlyValueTypeValue;
     72      if (ReadOnly) return this;
     73      var clone = (ValueTypeValue<T>)this.Clone();
     74      clone.readOnly = true;
     75      return clone;
    7576    }
    7677
Note: See TracChangeset for help on using the changeset viewer.